1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 09:28:21 +02:00

Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fixed bug #79821
This commit is contained in:
twosee
2020-07-11 06:15:28 +08:00
2 changed files with 24 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #79821 (array grow during var_dump)
--FILE--
<?php
$foo = $bar = [];
for ($i = 0; $i < 3; $i++) {
$foo = [$foo, [&$bar]];
}
ob_start(function (string $buffer) use (&$bar) {
$bar[][] = null;
return '';
}, 1);
var_dump($foo[0]);
ob_end_clean();
echo "OK\n";
?>
--EXPECT--
OK
+3
View File
@@ -132,6 +132,7 @@ again:
PUTS("*RECURSION*\n");
return;
}
GC_ADDREF(myht);
GC_PROTECT_RECURSION(myht);
}
count = zend_array_count(myht);
@@ -538,8 +539,10 @@ again:
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) {
php_array_element_export(val, index, key, level, buf);
} ZEND_HASH_FOREACH_END();
if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
GC_UNPROTECT_RECURSION(myht);
GC_DELREF(myht);
}
if (level > 1) {
buffer_append_spaces(buf, level - 1);