xref: /PHP-8.1/ext/soap/tests/bug70211.phpt (revision 32d663e1)
1--TEST--
2Bug #70211 (php 7 ZEND_HASH_IF_FULL_DO_RESIZE use after free)
3--EXTENSIONS--
4soap
5--SKIPIF--
6<?php
7if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
8?>
9--FILE--
10<?php
11
12$addr = 0x4141414141414141;
13
14function ptr2str($ptr)
15{
16    $out = "";
17    for ($i=0; $i<8; $i++) {
18        $out .= chr($ptr & 0xff);
19        $ptr >>= 8;
20    }
21    return $out;
22}
23
24$sf = new SoapFault('1', 'string', 'detail', 'header','line', str_repeat("A",232).ptr2str($addr));
25$ob = unserialize("a:3:{i:0;".serialize($sf).'i:1;R:13;i:2;R:11;}');
26
27var_dump($ob[1]);
28?>
29--EXPECT--
30string(6) "detail"
31