1
0
mirror of https://github.com/php/php-src.git synced 2026-04-08 00:22:52 +02:00

Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fixed bug #79778
This commit is contained in:
Nikita Popov
2020-07-07 10:20:11 +02:00
3 changed files with 36 additions and 1 deletions

4
NEWS
View File

@@ -12,7 +12,9 @@ PHP NEWS
- Core:
. Fixed bug #79740 (serialize() and unserialize() methods can not be called
statically). (Nikita)
. Fixede bug #79783 (Segfault in php_str_replace_common). (Nikita)
. Fixed bug #79783 (Segfault in php_str_replace_common). (Nikita)
. Fixed bug #79778 (Assertion failure if dumping closure with unresolved
static variable). (Nikita)
- Fileinfo:
. Fixed bug #79756 (finfo_file crash (FILEINFO_MIME)). (cmb)

26
Zend/tests/bug79778.phpt Normal file
View File

@@ -0,0 +1,26 @@
--TEST--
Bug #79778: Assertion failure if dumping closure with unresolved static variable
--FILE--
<?php
$closure1 = function() {
static $var = CONST_REF;
};
var_dump($closure1);
print_r($closure1);
?>
--EXPECT--
object(Closure)#1 (1) {
["static"]=>
array(1) {
["var"]=>
string(14) "<constant ast>"
}
}
Closure Object
(
[static] => Array
(
[var] => <constant ast>
)
)

View File

@@ -531,10 +531,17 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
debug_info = zend_new_array(8);
if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) {
zval *var;
HashTable *static_variables =
ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr);
ZVAL_ARR(&val, zend_array_dup(static_variables));
zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_STATIC), &val);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(val), var) {
if (Z_TYPE_P(var) == IS_CONSTANT_AST) {
zval_ptr_dtor(var);
ZVAL_STRING(var, "<constant ast>");
}
} ZEND_HASH_FOREACH_END();
}
if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {