1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01: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:
Nikita Popov
2021-08-27 11:59:38 +02:00
2 changed files with 13 additions and 0 deletions

View 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)

View File

@@ -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 */