summaryrefslogtreecommitdiff
path: root/Zend/zend_closures.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_closures.c')
-rw-r--r--Zend/zend_closures.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index d52d0b5c25..fd0738f32f 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -77,16 +77,17 @@ static zend_bool zend_valid_closure_binding(
zend_closure *closure, zval *newthis, zend_class_entry *scope) /* {{{ */
{
zend_function *func = &closure->func;
+ zend_bool is_fake_closure = (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) != 0;
if (newthis) {
if (func->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(E_WARNING, "Cannot bind an instance to a static closure");
return 0;
}
- if (func->type == ZEND_INTERNAL_FUNCTION && func->common.scope &&
+ if (is_fake_closure && func->common.scope &&
!instanceof_function(Z_OBJCE_P(newthis), func->common.scope)) {
/* Binding incompatible $this to an internal method is not supported. */
- zend_error(E_WARNING, "Cannot bind internal method %s::%s() to object of class %s",
+ zend_error(E_WARNING, "Cannot bind method %s::%s() to object of class %s",
ZSTR_VAL(func->common.scope->name),
ZSTR_VAL(func->common.function_name),
ZSTR_VAL(Z_OBJCE_P(newthis)->name));
@@ -105,7 +106,7 @@ static zend_bool zend_valid_closure_binding(
return 0;
}
- if ((func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) && scope != func->common.scope) {
+ if (is_fake_closure && scope != func->common.scope) {
zend_error(E_WARNING, "Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()");
return 0;
}