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