From 6540797f1ef5116d9c806baebc43582980db242d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 4 Dec 2019 09:40:48 +0100 Subject: [PATCH] Fixed bug #78898 --- NEWS | 2 ++ Zend/tests/bug78898.phpt | 34 ++++++++++++++++++++++++++++++++++ Zend/zend_API.c | 12 +++++++----- 3 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 Zend/tests/bug78898.phpt diff --git a/NEWS b/NEWS index 1c7775c45f3..82f20812c01 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ PHP NEWS (Antony Dovgal, Dmitry) . Fixed bug #78296 (is_file fails to detect file). (cmb) . Fixed bug #78883 (fgets(STDIN) fails on Windows). (cmb) + . Fixed bug #78898 (call_user_func(['parent', ...]) fails while other + succeed). (Nikita) - GD: . Fixed bug #78849 (GD build broken with -D SIGNED_COMPARE_SLOW). (cmb) 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 e7566194fcf..195dd7d3d7c 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3117,11 +3117,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 {