com php-src: Fixed run-time binding of preloaded dynamically declared function: NEWS Zend/zend_compile.c
| From: | Dmitry Stogov | Date: | Wed, 28 Oct 2020 10:50:14 +0000 |
| Subject: | com php-src: Fixed run-time binding of preloaded dynamically declared function: NEWS Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-113963@lists.php.net to get a copy of this message | ||
Commit: 68f80be9d1380de731930187250a7ed6b55ae196
Author: Dmitry Stogov <dmitry@zend.com> Wed, 28 Oct 2020 13:50:14 +0300
Parents: 990bb34891c83d12c5129fd781893704f948f2f4
Branches: PHP-7.4 PHP-8.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=68f80be9d1380de731930187250a7ed6b55ae196
Log:
Fixed run-time binding of preloaded dynamically declared function
Changed paths:
M NEWS
M Zend/zend_compile.c
Diff:
diff --git a/NEWS b/NEWS
index c848134c7cc..64968cb7ddc 100644
--- a/NEWS
+++ b/NEWS
@@ -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).
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 10ea65f89d9..810e384177e 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -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;