On 18 September 2015 20:37:07 BST, Benoit Schildknecht <bensor...@neuf.fr> 
wrote:
>So there is a bug regarding variables and null. Because I don't get any
> 
>notice if I use a variable with "null" as a value. If "null" means  
>"uninitialized", how come there are no notices ?

It's the other way around - null doesn't mean uninitialized, but an 
uninitialized variable has the implicit value null. It's also a reasonably 
likely sign that there's a bug in your code, so PHP gives you a notice 
suggesting you set it explicitly before reading from it.


> I personally use array_key_exists(), but most people won't
>do  
>the same at all. Because they think it is the same. And they'll forget,

As I've said several times, a simplified name and syntax for array_key_exists 
might be a good idea.


>Using is_null() against a var to see if it is set and has a null value 
>WILL trigger notices, and that's clearly not clean at all.

Sure, which is exactly why isset() makes sense. If we could rename it 
quiet_is_null(), would you think it's behaviour made sense?


>There are way more cases in which exists() would improve things A LOT.
>We  
>need a native function that allows us to check this state WITHOUT  
>triggering a notice.

Adding exists() has absolutely nothing to do with avoiding notices. It is 
simply not true that you can do things now and receive notices which you could 
do with exists() and receive no notices. The things you could do with exists 
are simply impossible right now.

It would not be a replacement for is_null, nor for isset(), but a way of 
writing a completely new type of code, which examined not a variable's value, 
but its state within the Engine. 

Regards,
-- 
Rowan Collins
[IMSoP]


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to