diff --git a/Zend/tests/bug78898.phpt b/Zend/tests/bug78898.phpt new file mode 100644 index 00000000000..9efd1416e20 --- /dev/null +++ b/Zend/tests/bug78898.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #78898: call_user_func(['parent', ...]) fails while other succeed +--FILE-- +x(); + +?> +--EXPECT-- +aaa diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 8868090b1be..18d09f96c15 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2933,11 +2933,13 @@ static zend_always_inline int zend_is_callable_check_func(int check_flags, zval ((fcc->object && fcc->calling_scope->__call) || (!fcc->object && fcc->calling_scope->__callstatic)))) { scope = zend_get_executed_scope(); - if (fcc->function_handler->common.scope != scope - || !zend_check_protected(zend_get_function_root_class(fcc->function_handler), scope)) { - retval = 0; - fcc->function_handler = NULL; - goto get_function_via_handler; + if (fcc->function_handler->common.scope != scope) { + if ((fcc->function_handler->common.fn_flags & ZEND_ACC_PRIVATE) + || !zend_check_protected(zend_get_function_root_class(fcc->function_handler), scope)) { + retval = 0; + fcc->function_handler = NULL; + goto get_function_via_handler; + } } } } else {