From acbecd7b31b3b05dd14c11dbe5b856c7522664b3 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 11 Oct 2015 10:30:44 -0300 Subject: [PATCH] - Fixed regression when calling func_get_args() from global scope --- Zend/tests/func_get_args.phpt | 10 ++++++++++ Zend/zend_builtin_functions.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/func_get_args.phpt diff --git a/Zend/tests/func_get_args.phpt b/Zend/tests/func_get_args.phpt new file mode 100644 index 0000000000..eea8ae4354 --- /dev/null +++ b/Zend/tests/func_get_args.phpt @@ -0,0 +1,10 @@ +--TEST-- +Testing func_get_args() +--FILE-- + +--EXPECTF-- +Warning: func_get_args(): Called from the global scope - no function context in %s on line 3 diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 8ffdcaa0bc..347d169180 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -487,7 +487,7 @@ ZEND_FUNCTION(func_get_args) uint32_t i, n; zend_execute_data *ex = EX(prev_execute_data); - if (ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) { + if (!ex || ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) { zend_error(E_WARNING, "func_get_args(): Called from the global scope - no function context"); RETURN_FALSE; } -- 2.40.0