xref: /PHP-8.1/ext/standard/tests/bug79821.phpt (revision 56dec3cc)
1--TEST--
2Bug #79821 (array grow during var_dump)
3--FILE--
4<?php
5
6foreach (['var_dump', 'debug_zval_dump', 'var_export'] as $output) {
7    $foo = $bar = [];
8    for ($i = 0; $i < 3; $i++) {
9        $foo = [$foo, [&$bar]];
10    }
11    ob_start(function (string $buffer) use (&$bar) {
12        $bar[][] = null;
13        return '';
14    }, 64);
15    $output($foo[0]);
16    ob_end_clean();
17}
18
19echo "OK\n";
20
21?>
22--EXPECT--
23OK
24