mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Zend: Return anonymous closure names in zend_get_callable_name_ex()
(#19011)
This returns the usual `{closure:FILE_NAME/FUNCTION:LINE_NO}` for anonymous functions rather than `Closure::__invoke` this is visible for `is_callable()` and any Engine call that uses `zend_fcall_info_init()` to get the name of the callable. Related to GH-18063.
This commit is contained in:
parent
4492a4219a
commit
f91f80ca19
3 changed files with 9 additions and 12 deletions
|
@ -42,9 +42,9 @@ Foo::__invoke
|
|||
bool(true)
|
||||
Foo::__invoke
|
||||
bool(true)
|
||||
Closure::__invoke
|
||||
bool(true)
|
||||
Closure::__invoke
|
||||
{closure:foo():9}
|
||||
bool(true)
|
||||
{closure:foo():9}
|
||||
bool(true)
|
||||
Closure::__invoke
|
||||
bool(true)
|
||||
|
|
|
@ -4160,13 +4160,10 @@ try_again:
|
|||
if (ce == zend_ce_closure) {
|
||||
const zend_function *fn = zend_get_closure_method_def(Z_OBJ_P(callable));
|
||||
|
||||
if (fn->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) {
|
||||
if (fn->common.scope) {
|
||||
return zend_create_member_string(fn->common.scope->name, fn->common.function_name);
|
||||
} else {
|
||||
return zend_string_copy(fn->common.function_name);
|
||||
}
|
||||
if ((fn->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) && fn->common.scope) {
|
||||
return zend_create_member_string(fn->common.scope->name, fn->common.function_name);
|
||||
}
|
||||
return zend_string_copy(fn->common.function_name);
|
||||
}
|
||||
|
||||
return zend_string_concat2(
|
||||
|
|
|
@ -57,11 +57,11 @@ Array
|
|||
[5] => E::f
|
||||
[6] => E::g
|
||||
[7] => E::__invoke
|
||||
[8] => Closure::__invoke
|
||||
[8] => {closure:%s:%d}
|
||||
)
|
||||
Array
|
||||
(
|
||||
[name] => Closure::__invoke
|
||||
[name] => {closure:%s:%d}
|
||||
[type] => 1
|
||||
[flags] => 20593
|
||||
[level] => 8
|
||||
|
@ -161,7 +161,7 @@ Array
|
|||
|
||||
[8] => Array
|
||||
(
|
||||
[name] => Closure::__invoke
|
||||
[name] => {closure:%s:%d}
|
||||
[type] => 1
|
||||
[flags] => 20593
|
||||
[level] => 8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue