Re: Weird constant expression syntax and bug
| From: | Bob Weinand | Date: | Sun, 27 Jul 2014 11:02:32 +0000 |
| Subject: | Re: Weird constant expression syntax and bug | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76194@lists.php.net to get a copy of this message | ||
Am 27.7.2014 um 10:55 schrieb Stas Malyshev <smalyshev@sugarcrm.com>:
> Hi!
>
>> Yes, I agree that this is not correct behavior - and I don't really
>> understand why it was introduced and why it isn't trivial to fix.
>> PHP-5.5 had a check for this case in place
>> (http://lxr.php.net/xref/PHP_5_5/Zend/zend_compile.c#7071) and phpng
>> contains an AST-compatible variant of the array check
>> (http://lxr.php.net/xref/phpng/Zend/zend_compile.c#7776). Shouldn't
>> copying the condition from phpng into PHP-5.6 resolve this issue?
>
> I agree it should be easy to fix it this way, but I'd like for Bob to
> provide a bit more input here as to best way to resolve it. I'm not sure
> why usage of arrays in runtime is disallowed now in 5.6 code, so I'm not
> sure if we should enable it or remove it.
>
> If we don't find another way soon, I guess porting one from phpng is
> what we'll have to do.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
The AST compatible fix in phpng is just for top-level arrays, but not for something like
"constant ? [1] : [2]".
I think we should just enable it, that would lower the level of confusion.
I totally agree that current status isn't optimal.
Bob