xref: /PHP-7.3/Zend/tests/bug78010.phpt (revision 193f28c7)
1--TEST--
2Bug #78010: Segmentation fault during GC
3--INI--
4memory_limit=2G
5--FILE--
6<?php
7
8class foo
9{
10    public function __construct()
11    {
12        $this->x = $this;
13
14        for ($i = 0; $i < 898; $i++) { //Will not trigger with <898
15            $obj = [new stdClass, new stdClass]; //This must have at least 2 elements
16            $this->y[] = $obj;
17        }
18    }
19}
20
21for ($i = 0; $i < 2; ++$i) { //This must run >=2 (increasing the number of elements in the array *2 will not do)
22    $x = []; //This must be reset
23    foreach (array_fill(0, 389, 'x') as &$params) { //Will not trigger <389
24        $x[] = new foo;
25    }
26}
27
28echo "Completed\n";
29
30?>
31--EXPECT--
32Completed
33