Re: com php-src: - Fixed regression when calling func_get_args() from global scope: Zend/tests/func_get_args.phpt Zend/zend_builtin_functions.c
| From: | Felipe Pena | Date: | Mon, 12 Oct 2015 11:43:49 +0000 |
| Subject: | Re: com php-src: - Fixed regression when calling func_get_args() from global scope: Zend/tests/func_get_args.phpt Zend/zend_builtin_functions.c | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-89372@lists.php.net to get a copy of this message | ||
Hi Dmitry,
On Mon, Oct 12, 2015 at 4:38 AM, Dmitry Stogov <dmitry@zend.com> wrote:
> Hi Felipe,
>
> EX(prev_execute_data) can't be NULL in internal function in PHP-7.
> Could you please explain what did you fix with this additional check?
>
> Thanks. Dmitry.
>
Humm, I just noticed that segfault was due ex being NULL when calling
func_get_args() out of function scope, so if it's not the right fix
something is not working right on the engine.
> On Sun, Oct 11, 2015 at 4:30 PM, Felipe Pena <felipe@php.net> wrote:
>>
>> Commit: acbecd7b31b3b05dd14c11dbe5b856c7522664b3
>> Author: Felipe Pena <felipensp@gmail.com> Sun, 11 Oct 2015
>> 10:30:44 -0300
>> Parents: 9f27624641931f2035a2798d6660e8a4a931556f
>> Branches: master
>>
>> Link:
>> XT
>> j»WoµõÃ⣘ŸÎáhttp://git.php.net/?p=php-src.git;a=commitdiff;h=acbecd7b31b3b05dd14c11dbe5b856c7522664b3
>>
>> Log:
>> - Fixed regression when calling func_get_args() from global scope
>>
>> Changed paths:
>> A Zend/tests/func_get_args.phpt
>> M Zend/zend_builtin_functions.c
>>
>>
>> Diff:
>> diff --git a/Zend/tests/func_get_args.phpt b/Zend/tests/func_get_args.phpt
>> new file mode 100644
>> index 0000000..eea8ae43
>> --- /dev/null
>> +++ b/Zend/tests/func_get_args.phpt
>> @@ -0,0 +1,10 @@
>> +--TEST--
>> +Testing func_get_args()
>> +--FILE--
>> +<?php
>> +
>> +func_get_args();
>> +
>> +?>
>> +--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 8ffdcaa..347d169 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;
>> }
>>
>>
>> --
>> PHP CVS Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
--
Regards,
Felipe Pena