Re: Weird constant expression syntax and bug

From: Date: Sun, 27 Jul 2014 08:52:22 +0000
Subject: Re: Weird constant expression syntax and bug
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-76189@lists.php.net to get a copy of this message
On Sun, Jul 27, 2014 at 12:02 AM, Stas Malyshev <smalyshev@sugarcrm.com> wrote: > Hi! > > > Could somebody please clarify what issues are still open here? From what > > I understand, both the opcache issue and the recursion issue are fixed > > now. What's the discussion about? > > As I understand, the issue is that if you define class constant like this: > > class Foo { const Bar = [0]; } > > everything works fine. But if you do var_dump(Foo::Bar), it bombs out > with fatal error (the same goes for every other usage of that constant > in expression). Please correct me if my info is outdated, but I think it > is a behavior that should not be left in the release. If for some reason > we can't make array constants work normally, we should just omit them > altogether. > 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? Nikita

« previous php.internals (#76189) next »