Pierre, On Wed, May 2, 2012 at 5:43 AM, Pierre Joye <pierre....@gmail.com> wrote: > hi, > > On Wed, May 2, 2012 at 11:36 AM, Ferenc Kovacs <tyr...@gmail.com> 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).
Well, except that it doesn't unset it. It only fails isset(). The symbol still exists in the symbol table, and the zval is still allocated. That's one reason that isset() can return false, and array_key_exists() will return true. But right now there's no way to check if a symbol exists since isset returns falls for a null value in a symbol (and there's no other way to check it)... Not saying it should change, just that it's a corner case that's not accounted for in the API... 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... Anthony >>> 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. > > Cheers, > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php