1
0
mirror of https://github.com/php/php-src.git synced 2026-04-03 06:02:23 +02:00

Merge branch 'PHP-7.4'

* PHP-7.4:
  Fixed bug #79821
This commit is contained in:
twosee
2020-07-11 06:19:41 +08:00
2 changed files with 24 additions and 0 deletions

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

View File

@@ -127,6 +127,7 @@ again:
PUTS("*RECURSION*\n");
return;
}
GC_ADDREF(myht);
GC_PROTECT_RECURSION(myht);
}
count = zend_array_count(myht);
@@ -528,8 +529,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);