Re: com php-src: assert won't cause indrect var access if it's disabled: ext/opcache/Optimizer/zend_cfg.c
| From: | Xinchen Hui | Date: | Sat, 28 May 2016 07:11:17 +0000 |
| Subject: | Re: com php-src: assert won't cause indrect var access if it's disabled: ext/opcache/Optimizer/zend_cfg.c | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-92223@lists.php.net to get a copy of this message | ||
Hey:
On Sat, May 28, 2016 at 1:51 AM, Nikita Popov <nikita.ppv@gmail.com> wrote:
> On Fri, May 27, 2016 at 7:48 PM, Xinchen Hui <laruence@php.net> wrote:
>
>> Commit: 27f40676e6f506f353ad8d679dd9b21aa87b828e
>> Author: Xinchen Hui <laruence@gmail.com> Fri, 27 May 2016
>> 10:48:36 -0700
>> Parents: da511f255ac8e86284bdff6d7bc78d0b5c9b001f
>> Branches: master
>>
>> Link:
>>
>> http://git.php.net/?p=php-src.git;a=commitdiff;h=27f40676e6f506f353ad8d679dd9b21aa87b828e
>>
>> Log:
>> assert won't cause indrect var access if it's disabled
>>
>> Changed paths:
>> M ext/opcache/Optimizer/zend_cfg.c
>>
>>
>> Diff:
>> diff --git a/ext/opcache/Optimizer/zend_cfg.c
>> b/ext/opcache/Optimizer/zend_cfg.c
>> index 9701f58..a4403a0 100644
>> --- a/ext/opcache/Optimizer/zend_cfg.c
>> +++ b/ext/opcache/Optimizer/zend_cfg.c
>> @@ -331,7 +331,7 @@ int zend_build_cfg(zend_arena **arena, const
>> zend_op_array *op_array, uint32_t b
>> flags |=
>> ZEND_FUNC_INDIRECT_VAR_ACCESS;
>> } else if
>> (zend_string_equals_literal(Z_STR_P(zv), "get_defined_vars")) {
>> flags |=
>> ZEND_FUNC_INDIRECT_VAR_ACCESS;
>> - } else if
>> (zend_string_equals_literal(Z_STR_P(zv), "assert")) {
>> + } else if (EG(assertions)
>> >= 0 && zend_string_equals_literal(Z_STR_P(zv), "assert")) {
>> flags |=
>> ZEND_FUNC_INDIRECT_VAR_ACCESS;
>> } else if
>> (zend_string_equals_literal(Z_STR_P(zv), "func_num_args")) {
>> flags |=
>> ZEND_FUNC_VARARG;
>>
>>
>> --
>> PHP CVS Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> If it's disabled as assertions=-1, it shouldn't generate any assert() call
> in the first place, right?
>
yes, this had been reverted soon after this commit.
https://github.com/php/php-src/commit/4935c032762c376c19308b7cdf1b77780f1b073a
anway, EG(assertion) can be toggled between 0, and 1 in run-time by
ini_set, so in theory, if it's 0, it should not cause
INDIRECT_VAR_ACCESS.
but we can not be aware of ini_set aginst it.
thanks
>
>
> Nikita
>
>
--
Xinchen Hui
@Laruence
http://www.laruence.com/