Skip to content

Commit 68f80be

Browse files
committed
Fixed run-time binding of preloaded dynamically declared function
1 parent 990bb34 commit 68f80be

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ PHP NEWS
2525
- Opcache:
2626
. Fixed bug #79643 (PHP with Opcache crashes when a file with specific name
2727
is included). (twosee)
28+
. Fixed run-time binding of preloaded dynamically declared function. (Dmitry)
2829

2930
- OpenSSL:
3031
. Fixed bug #79983 (openssl_encrypt / openssl_decrypt fail with OCB mode).

Zend/zend_compile.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,11 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */
10501050
return FAILURE;
10511051
}
10521052
function = (zend_function*)Z_PTR_P(zv);
1053-
zv = zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, Z_STR_P(lcname));
1053+
if (UNEXPECTED(function->common.fn_flags & ZEND_ACC_PRELOADED)) {
1054+
zv = zend_hash_add(EG(function_table), Z_STR_P(lcname), zv);
1055+
} else {
1056+
zv = zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, Z_STR_P(lcname));
1057+
}
10541058
if (UNEXPECTED(!zv)) {
10551059
do_bind_function_error(Z_STR_P(lcname), &function->op_array, 0);
10561060
return FAILURE;

0 commit comments

Comments
 (0)