Fixed run-time binding of preloaded dynamically declared function

This commit is contained in:
Dmitry Stogov 2020-10-28 13:50:14 +03:00
parent 990bb34891
commit 68f80be9d1
2 changed files with 6 additions and 1 deletions

1
NEWS
View File

@ -25,6 +25,7 @@ PHP NEWS
- Opcache:
. Fixed bug #79643 (PHP with Opcache crashes when a file with specific name
is included). (twosee)
. Fixed run-time binding of preloaded dynamically declared function. (Dmitry)
- OpenSSL:
. Fixed bug #79983 (openssl_encrypt / openssl_decrypt fail with OCB mode).

View File

@ -1050,7 +1050,11 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */
return FAILURE;
}
function = (zend_function*)Z_PTR_P(zv);
zv = zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, Z_STR_P(lcname));
if (UNEXPECTED(function->common.fn_flags & ZEND_ACC_PRELOADED)) {
zv = zend_hash_add(EG(function_table), Z_STR_P(lcname), zv);
} else {
zv = zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, Z_STR_P(lcname));
}
if (UNEXPECTED(!zv)) {
do_bind_function_error(Z_STR_P(lcname), &function->op_array, 0);
return FAILURE;