mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.0'
* PHP-8.0: Fix Closure::call() on internal method closure
This commit is contained in:
commit
2cc47a04df
2 changed files with 13 additions and 0 deletions
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)
|
|
@ -152,6 +152,9 @@ ZEND_METHOD(Closure, call)
|
||||||
my_function.common.fn_flags &= ~ZEND_ACC_CLOSURE;
|
my_function.common.fn_flags &= ~ZEND_ACC_CLOSURE;
|
||||||
/* use scope of passed object */
|
/* use scope of passed object */
|
||||||
my_function.common.scope = newclass;
|
my_function.common.scope = newclass;
|
||||||
|
if (closure->func.type == ZEND_INTERNAL_FUNCTION) {
|
||||||
|
my_function.internal_function.handler = closure->orig_internal_handler;
|
||||||
|
}
|
||||||
fci_cache.function_handler = &my_function;
|
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 */
|
/* Runtime cache relies on bound scope to be immutable, hence we need a separate rt cache in case scope changed */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue