mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix Closure::call() on internal method closure
This commit is contained in:
commit
2467f759f5
10
Zend/tests/closure_call_internal.phpt
Normal file
10
Zend/tests/closure_call_internal.phpt
Normal file
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Closure::call() on internal method
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(Closure::fromCallable([new DateTime(), 'getTimestamp'])->call(new DateTime('@123')));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(123)
|
@ -155,6 +155,9 @@ ZEND_METHOD(Closure, call)
|
||||
my_function.common.fn_flags &= ~ZEND_ACC_CLOSURE;
|
||||
/* use scope of passed object */
|
||||
my_function.common.scope = Z_OBJCE_P(newthis);
|
||||
if (closure->func.type == ZEND_INTERNAL_FUNCTION) {
|
||||
my_function.internal_function.handler = closure->orig_internal_handler;
|
||||
}
|
||||
fci_cache.function_handler = &my_function;
|
||||
|
||||
/* Runtime cache relies on bound scope to be immutable, hence we need a separate rt cache in case scope changed */
|
||||
|
Loading…
Reference in New Issue
Block a user