xref: /PHP-7.0/Zend/tests/bug63055.phpt (revision 388624d3)
1--TEST--
2Bug #63055 (Segfault in zend_gc with SF2 testsuite)
3--INI--
4zend.enable_gc=1
5--FILE--
6<?php
7/* the default gc root size is 10,000 */
8for ($i=0; $i<9998; $i++) {
9    $array = array();
10    $array[0] = &$array;
11    unset($array);
12}
13
14$matches = array("foo" => "bar"); /* this bucket will trigger the segfault */
15$dummy   = array("dummy");        /* used to trigger gc_collect_cycles */
16$dummy[1] = &$dummy;
17
18$matches[1] = &$matches;
19$matches[2] = $dummy;
20
21str_replace("foo", "bar", "foobar", $matches);
22echo "okey";
23?>
24--EXPECTF--
25okey
26