Skip to content

Commit a1ba52d

Browse files
committed
Zend: Fix anonymous closure names
1 parent 51149b6 commit a1ba52d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Zend/tests/closures/closure_016.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Foo::__invoke
4242
bool(true)
4343
Foo::__invoke
4444
bool(true)
45-
Closure::__invoke
45+
{closure:foo():9}
4646
bool(true)
47-
Closure::__invoke
47+
{closure:foo():9}
4848
bool(true)
4949
Closure::__invoke
5050
bool(true)

Zend/zend_API.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4160,13 +4160,10 @@ ZEND_API zend_string *zend_get_callable_name_ex(zval *callable, zend_object *obj
41604160
if (ce == zend_ce_closure) {
41614161
const zend_function *fn = zend_get_closure_method_def(Z_OBJ_P(callable));
41624162

4163-
if (fn->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) {
4164-
if (fn->common.scope) {
4165-
return zend_create_member_string(fn->common.scope->name, fn->common.function_name);
4166-
} else {
4167-
return zend_string_copy(fn->common.function_name);
4168-
}
4163+
if (fn->common.fn_flags & ZEND_ACC_FAKE_CLOSURE && fn->common.scope) {
4164+
return zend_create_member_string(fn->common.scope->name, fn->common.function_name);
41694165
}
4166+
return zend_string_copy(fn->common.function_name);
41704167
}
41714168

41724169
return zend_string_concat2(

0 commit comments

Comments
 (0)