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