Re: [PHP-DEV] Weird constant expression syntax and bug

2014-08-04 Thread Dmitry Stogov
Bob, I see you already committed this into PHP-5.6. I would agree that new behavior is more consistent and may be committed into master, but I'm still afraid that it may bring as problems because of last minute changes and lack of tests coverage. Thanks. Dmitry. On Sun, Jul 27, 2014 at 3:02 PM

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-27 Thread Bob Weinand
Am 27.7.2014 um 10:55 schrieb Stas Malyshev : > 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#70

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-27 Thread Stas Malyshev
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

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-27 Thread Nikita Popov
On Sun, Jul 27, 2014 at 12:02 AM, Stas Malyshev 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 yo

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-26 Thread Stas Malyshev
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]; } e

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-26 Thread Ferenc Kovacs
On Sat, Jul 26, 2014 at 5:42 PM, Nikita Popov wrote: > On Fri, Jul 25, 2014 at 11:03 PM, Julien Pauli wrote: > > > On Wed, Jul 23, 2014 at 8:12 PM, Dmitry Stogov wrote: > > > >> PHP-5.6 is frozen for new features for a long time. > >> Adding new features after RC is not a good idea. > >> And we

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-26 Thread Nikita Popov
On Fri, Jul 25, 2014 at 11:03 PM, Julien Pauli wrote: > On Wed, Jul 23, 2014 at 8:12 PM, Dmitry Stogov wrote: > >> PHP-5.6 is frozen for new features for a long time. >> Adding new features after RC is not a good idea. >> And we will need some kind of RFC and voting. >> > > I agree here. > > Bob

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-25 Thread Julien Pauli
On Wed, Jul 23, 2014 at 8:12 PM, Dmitry Stogov wrote: > PHP-5.6 is frozen for new features for a long time. > Adding new features after RC is not a good idea. > And we will need some kind of RFC and voting. > I agree here. Bob, if you've been late proposing an RFC and couldn't get it up in time

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-25 Thread Ferenc Kovacs
On Fri, Jul 25, 2014 at 4:36 PM, Ferenc Kovacs wrote: > > > > On Wed, Jul 23, 2014 at 10:45 PM, Bob Weinand wrote: > >> Am 23.7.2014 um 22:33 schrieb Stas Malyshev : >> > Hi! >> > >> >> It was a restriction to not support arrays in constant context. It >> seems >> >> like nobody can remember why

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-25 Thread Ferenc Kovacs
On Wed, Jul 23, 2014 at 10:45 PM, Bob Weinand wrote: > Am 23.7.2014 um 22:33 schrieb Stas Malyshev : > > Hi! > > > >> It was a restriction to not support arrays in constant context. It seems > >> like nobody can remember why it was introduced. > > > > My vague recollection is that it had some tro

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Kris Craig
On Wed, Jul 23, 2014 at 8:20 PM, Pierre Joye wrote: > hi, > > On Wed, Jul 23, 2014 at 10:45 PM, Bob Weinand wrote: > > > Well, we still could fix it now, AFAIK, we will still have another RC > now and when we fix it only for 5.6.1, there also will only be one RC in > between. > > That's no gain

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Pierre Joye
hi, On Wed, Jul 23, 2014 at 10:45 PM, Bob Weinand wrote: > Well, we still could fix it now, AFAIK, we will still have another RC now and > when we fix it only for 5.6.1, there also will only be one RC in between. > That's no gain in testing time etc.. Also please keep in mind that we are alrea

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Bob Weinand
Am 23.7.2014 um 22:33 schrieb Stas Malyshev : > Hi! > >> It was a restriction to not support arrays in constant context. It seems >> like nobody can remember why it was introduced. > > My vague recollection is that it had some troubles with keeping > refcounts consistent, esp. withing bytecode ca

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Stas Malyshev
Hi! > It was a restriction to not support arrays in constant context. It seems > like nobody can remember why it was introduced. My vague recollection is that it had some troubles with keeping refcounts consistent, esp. withing bytecode caching context, but it may be a false memory :) > However,

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Dmitry Stogov
PHP-5.6 is frozen for new features for a long time. Adding new features after RC is not a good idea. And we will need some kind of RFC and voting. I help you technically, but you know my opinion about this feature.. anyway, lets fix bugs first, I got an idea that may work... Thanks. Dmitry. On

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Bob Weinand
Am 23.7.2014 um 11:34 schrieb Dmitry Stogov : > On Wed, Jul 23, 2014 at 1:20 PM, Bob Weinand wrote: > >> Yes. Did you see my thoughts before? >> >> I'm just wondering if we can't somehow deeply copy the asts for opcache >>> between compile time and run time in pass_two() (If I'm not wrong >>> pa

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Dmitry Stogov
On Wed, Jul 23, 2014 at 1:20 PM, Bob Weinand wrote: > Yes. Did you see my thoughts before? > > I'm just wondering if we can't somehow deeply copy the asts for opcache >> between compile time and run time in pass_two() (If I'm not wrong >> pass_two() has some hook for zend extensions?) >> >> Then

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Bob Weinand
Yes. Did you see my thoughts before? > I'm just wondering if we can't somehow deeply copy the asts for opcache > between compile time and run time in pass_two() (If I'm not wrong pass_two() > has some hook for zend extensions?) > > Then we can fix the ast and don't have to take care of opcache

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Dmitry Stogov
On Wed, Jul 23, 2014 at 12:16 PM, Bob Weinand wrote: > Hey, thank you for looking into it :-) > > Am 23.7.2014 um 00:23 schrieb Dmitry Stogov : > > hi Bob, > > > > I still think that current array usage in constant expressions is not > > consistent and dangerous. It "smells" to me, and I think it

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Stas Malyshev
Hi! >> > class Foo { >>const BAR = [0]; >>static $a = Foo::BAR; // constant array usage >> } >> var_dump(Foo::$a); // prints array >> var_dump(Foo::BAR); // emits fatal error >> ?> > > They can only be used in static scalar contexts. > > I wanted to introduce constants to be used an

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-23 Thread Bob Weinand
Hey, thank you for looking into it :-) Am 23.7.2014 um 00:23 schrieb Dmitry Stogov : > hi Bob, > > I still think that current array usage in constant expressions is not > consistent and dangerous. It "smells" to me, and I think it may bring > troubles in the future even if the existing known bugs

Re: [PHP-DEV] Weird constant expression syntax and bug

2014-07-22 Thread Dmitry Stogov
hi Bob, I still think that current array usage in constant expressions is not consistent and dangerous. It "smells" to me, and I think it may bring troubles in the future even if the existing known bugs are fixed. I see few issues: 1) It is possible to declare array class constants however they