Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-05 Thread Richard Lynch
On Fri, May 4, 2012 2:10 pm, Kris Craig wrote: > On Fri, May 4, 2012 at 11:48 AM, Richard Lynch wrote: > >> On Wed, May 2, 2012 4:43 am, Pierre Joye wrote: >> >>> empty() on the other hand, tests if something is empty, and only >> if >> >>> it >> >>> is empty. The result of an expression can be e

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-04 Thread Ferenc Kovacs
> > > Hmm I'd never really thought about that before. But now that you mention > it, that does sound like a problem. Honestly, I can see no value in > maintaining a different "standard" for what constitutes a set or not-set > variable depending on the function. While I understand Pierre's point

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-04 Thread Kris Craig
On Fri, May 4, 2012 at 1:27 PM, Ferenc Kovacs wrote: > >> I've been following the debate and I'm still a bit unclear as to what the >> benefit would be to allowing non-variables in isset(). I mean, as was >> stated earlier, expressions are neither "set" nor "unset". Furthermore, >> if >> you we

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-04 Thread Ferenc Kovacs
> > > I've been following the debate and I'm still a bit unclear as to what the > benefit would be to allowing non-variables in isset(). I mean, as was > stated earlier, expressions are neither "set" nor "unset". Furthermore, if > you were to assign a variable to any valid expression (empty or ot

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-04 Thread Kris Craig
On Fri, May 4, 2012 at 11:48 AM, Richard Lynch wrote: > On Wed, May 2, 2012 4:43 am, Pierre Joye wrote: > >>> empty() on the other hand, tests if something is empty, and only if > >>> it > >>> is empty. The result of an expression can be empty. > >>> > >> > >> an expression can also have a value

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-04 Thread Richard Lynch
On Wed, May 2, 2012 4:43 am, Pierre Joye wrote: >>> empty() on the other hand, tests if something is empty, and only if >>> it >>> is empty. The result of an expression can be empty. >>> >> >> an expression can also have a value of null. > > And NULL is empty. No issue here. Expressions can also r

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-03 Thread Lester Caine
Patrick ALLAERT wrote: 2012/5/3 Lester Caine: Anthony Ferrara wrote: I voted for the ability to use an expression for isset() as well, since I agree with Ferenc, it's a matter of consistency. Sure, the use-case for isset() is definitely weaker than for empty(), but at the same token they are

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-03 Thread Herman Radtke
>> I just can't help feeling that it is the wrong use of both. If the function >> is returning a value, then it's returning a value that needs to be used >> somewhere so the work flow handles that. If the function returns nothing >> instead that just seems wrong and needs to be handled better. I'm

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-03 Thread Patrick ALLAERT
2012/5/3 Lester Caine : > Anthony Ferrara wrote: >> >> I voted for the ability to use an expression for isset() as well, >> since I agree with Ferenc, it's a matter of consistency.  Sure, the >> use-case for isset() is definitely weaker than for empty(), but at the >> same token they are definitely

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-03 Thread Lester Caine
Anthony Ferrara wrote: I voted for the ability to use an expression for isset() as well, since I agree with Ferenc, it's a matter of consistency. Sure, the use-case for isset() is definitely weaker than for empty(), but at the same token they are definitely related... I just can't help feeling

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-02 Thread Pierre Joye
hi Anthony, On Wed, May 2, 2012 at 1:37 PM, Anthony Ferrara wrote: > I voted for the ability to use an expression for isset() as well, > since I agree with Ferenc, it's a matter of consistency.  Sure, the > use-case for isset() is definitely weaker than for empty(), No, it is not about consiste

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-02 Thread Ferenc Kovacs
On Wed, May 2, 2012 at 11:43 AM, Pierre Joye wrote: > hi, > > On Wed, May 2, 2012 at 11:36 AM, Ferenc Kovacs wrote: > > > $foo=null; > > var_dump(isset($foo)); //prints bool(false) > > No offset meant, but it is totally expected and well known, and as far > as I remember documented too. Assignin

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-02 Thread Anthony Ferrara
Pierre, On Wed, May 2, 2012 at 5:43 AM, Pierre Joye wrote: > hi, > > On Wed, May 2, 2012 at 11:36 AM, Ferenc Kovacs wrote: > >> $foo=null; >> var_dump(isset($foo)); //prints bool(false) > > No offset meant, but it is totally expected and well known, and as far > as I remember documented too. Ass

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-02 Thread Pierre Joye
On Wed, May 2, 2012 at 11:43 AM, Pierre Joye wrote: > hi, > > On Wed, May 2, 2012 at 11:36 AM, Ferenc Kovacs wrote: > >> $foo=null; >> var_dump(isset($foo)); //prints bool(false) > > No offset meant, lapsus :) s,offset,offense, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.li

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-02 Thread Pierre Joye
hi, On Wed, May 2, 2012 at 11:36 AM, Ferenc Kovacs wrote: > $foo=null; > var_dump(isset($foo)); //prints bool(false) No offset meant, but it is totally expected and well known, and as far as I remember documented too. Assigning NULL to a variable unsets it (so to say). >> empty() on the other

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-02 Thread Ferenc Kovacs
On Wed, May 2, 2012 at 11:10 AM, Pierre Joye wrote: > hi, > > On Wed, May 2, 2012 at 10:46 AM, Laruence wrote: > > >so I think if you want to change empty, you should also change isset. > > An expression is not set per se. isset goals, by design, from the very > 1st day, is to test the exist

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-02 Thread Pierre Joye
hi, On Wed, May 2, 2012 at 10:46 AM, Laruence wrote: >    so I think if you want to change empty, you should also change isset. An expression is not set per se. isset goals, by design, from the very 1st day, is to test the existence of a variable and a variable only. empty() on the other hand,

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-02 Thread Laruence
On Mon, Apr 30, 2012 at 3:50 PM, Patrick ALLAERT wrote: > Hi, > > 2012/4/12 Nikita Popov : >> PS: I added isset() too, to address the consistency concerns mentioned on >> IRC. > > I would have voted +1 if it didn't contain the isset() change. None of > the examples used in the isset_with_expr.php

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Xinchen Hui
Sent from my iPhone 在 2012-5-2,3:52,Ferenc Kovacs 写道: >> >> >> So isset(UNDEFINEDCONSTANT) will be isset("UNDEFINEDCONSTANT") which >> will/should >> 1) yield a notice, which is unnexpected for isset >> 2) return true, which is also unexpected. >> >> I don't see much point in that. >> >> > yep,

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Ferenc Kovacs
> > > So isset(UNDEFINEDCONSTANT) will be isset("UNDEFINEDCONSTANT") which > will/should > 1) yield a notice, which is unnexpected for isset > 2) return true, which is also unexpected. > > I don't see much point in that. > > yep, and if we allow expressions then it is the expected behavior, but you

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Ferenc Kovacs
On Tue, May 1, 2012 at 7:24 PM, Patrick ALLAERT wrote: > 2012/5/1 Ferenc Kovacs : > > On Mon, Apr 30, 2012 at 2:39 PM, Nikita Popov >wrote: > > - both isset and empty are language constructs, which many people use > > almost interchangeability, changing one of them in a way that the same > > expr

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Patrick ALLAERT
2012/5/1 Ferenc Kovacs : > On Mon, Apr 30, 2012 at 2:39 PM, Nikita Popov > wrote: > - both isset and empty are language constructs, which many people use > almost interchangeability, changing one of them in a way that the same > expression works with one of them, but blows up with a parse error se

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Etienne Kneuss
Hi, On Tue, May 1, 2012 at 18:43, Ferenc Kovacs wrote: > > albeit I'm not laruence, but I also supported the idea to keep consistency > across the allowed params of empty and isset. > here is my reasoning: > - both isset and empty are language constructs, which many people use > almost interchang

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Ferenc Kovacs
On Mon, Apr 30, 2012 at 2:39 PM, Nikita Popov wrote: > On Mon, Apr 30, 2012 at 9:50 AM, Patrick ALLAERT > wrote: > > Hi, > > > > 2012/4/12 Nikita Popov : > >> PS: I added isset() too, to address the consistency concerns mentioned > on IRC. > > > > I would have voted +1 if it didn't contain the is

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-04-30 Thread Pierre Joye
hi, On Mon, Apr 30, 2012 at 3:05 PM, Nikita Popov wrote: > I changed the vote to have three options: "Both empty() and isset()", > "Only empty()" or "None" > > https://wiki.php.net/rfc/empty_isset_exprs#vote Please post a top thread to notice everyone about this new vote with a short explanatio

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-04-30 Thread Nikita Popov
On Mon, Apr 30, 2012 at 9:50 AM, Patrick ALLAERT wrote: > Hi, > > 2012/4/12 Nikita Popov : >> PS: I added isset() too, to address the consistency concerns mentioned on >> IRC. > > I would have voted +1 if it didn't contain the isset() change. None of > the examples used in the isset_with_expr.php

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-04-30 Thread Nikita Popov
On Mon, Apr 30, 2012 at 9:50 AM, Patrick ALLAERT wrote: > Hi, > > 2012/4/12 Nikita Popov : >> PS: I added isset() too, to address the consistency concerns mentioned on >> IRC. > > I would have voted +1 if it didn't contain the isset() change. None of > the examples used in the isset_with_expr.php

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-04-30 Thread Patrick ALLAERT
Hi, 2012/4/12 Nikita Popov : > PS: I added isset() too, to address the consistency concerns mentioned on IRC. I would have voted +1 if it didn't contain the isset() change. None of the examples used in the isset_with_expr.phpt test seems logic to me. Care to explain the consistency concerns here

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-04-13 Thread Nikita Popov
On Fri, Apr 13, 2012 at 12:42 AM, Galen Wright-Watson wrote: > Just to be clear, under the new behavior, calling "empty" or "isset" on > undefined variables and undefined array indices shouldn't produce a notice > when E_NOTICE is set, correct? Basically, the change isn't regressive. Yup, that's r

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-04-12 Thread Galen Wright-Watson
On Thu, Apr 12, 2012 at 2:42 PM, Nikita Popov wrote: > > As per the comments I created an RFC, proposing to allow arbitrary > expressions to be passed to empty() and isset(): > > https://wiki.php.net/rfc/empty_isset_exprs > > The patch is available as a PR: > > https://github.com/php/php-src/pull/

[PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-04-12 Thread Nikita Popov
Hi internals! As per the comments I created an RFC, proposing to allow arbitrary expressions to be passed to empty() and isset(): https://wiki.php.net/rfc/empty_isset_exprs The patch is available as a PR: https://github.com/php/php-src/pull/54 Nikita PS: I added isset() too, to address the co