xref: /PHP-8.0/Zend/tests/gc_043.phpt (revision 50c87e92)
1--TEST--
2GC buffer shouldn't get reused when removing nested data
3--FILE--
4<?php
5$s = <<<'STR'
6O:8:"stdClass":2:{i:5;C:8:"SplStack":29:{i:4;:r:1;:O:8:"stdClass":0:{}}i:0;O:13:"RegexIterator":1:{i:5;C:8:"SplStack":29:{i:4;:r:1;:O:8:"stdClass":0:{}}}}
7STR;
8var_dump(unserialize($s));
9gc_collect_cycles();
10?>
11--EXPECT--
12object(stdClass)#1 (2) {
13  ["5"]=>
14  object(SplStack)#2 (2) {
15    ["flags":"SplDoublyLinkedList":private]=>
16    int(4)
17    ["dllist":"SplDoublyLinkedList":private]=>
18    array(2) {
19      [0]=>
20      *RECURSION*
21      [1]=>
22      object(stdClass)#3 (0) {
23      }
24    }
25  }
26  ["0"]=>
27  object(RegexIterator)#4 (2) {
28    ["replacement"]=>
29    NULL
30    ["5"]=>
31    object(SplStack)#5 (2) {
32      ["flags":"SplDoublyLinkedList":private]=>
33      int(4)
34      ["dllist":"SplDoublyLinkedList":private]=>
35      array(2) {
36        [0]=>
37        *RECURSION*
38        [1]=>
39        object(stdClass)#6 (0) {
40        }
41      }
42    }
43  }
44}
45