On 19 September 2015 15:49:55 BST, Lester Caine <lester@lsces.co.uk> wrote:
>On 19/09/15 13:15, Rowan Collins wrote:
>If there was a bug with 'isset' it is that it returns false for a
>variable that IS SET to null.
I honestly think that the only problem there is the name. If instead of isset() and empty() we had quiet_is_null and quiet_boolval, nobody would be the slightest bit surprised by their behaviour, and people looking to see if an array key exists would be more likely to find array_key_exists.
>if the variable does not exist there is no way of testing for that
>state
>prior to calling is_null()
Correct, there is no way of testing for that full stop.
> so we get a warning. THAT is the warning
>that
>I'm talking about. Now if you have another way of identifying that the
>variable 'exists' before calling is_null() then I apologise but I've
>not
>found it yet :(
If what you want to do is avoid the notice, then you don't need to "find out before calling is_null", you need to call isset *instead of* is_null. Again, ignore the name, and concentrate on what it actually does.
This conversation feels to me like you saying you want a flying car, then complaining because your current car makes a nasty noise when you accelerate for take off in first gear. No matter what you do, your current car won't fly, but if you switch into fifth gear, the noise will go away.
You want a function to test for variable existence, which is a feature PHP does not have; you then jump to talking about not wanting warning noises, which PHP absolutely has the function to avoid.
It is not the noise that is stopping your car flying, so please stop talking about it.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
>On 19/09/15 13:15, Rowan Collins wrote:
>If there was a bug with 'isset' it is that it returns false for a
>variable that IS SET to null.
I honestly think that the only problem there is the name. If instead of isset() and empty() we had quiet_is_null and quiet_boolval, nobody would be the slightest bit surprised by their behaviour, and people looking to see if an array key exists would be more likely to find array_key_exists.
>if the variable does not exist there is no way of testing for that
>state
>prior to calling is_null()
Correct, there is no way of testing for that full stop.
> so we get a warning. THAT is the warning
>that
>I'm talking about. Now if you have another way of identifying that the
>variable 'exists' before calling is_null() then I apologise but I've
>not
>found it yet :(
If what you want to do is avoid the notice, then you don't need to "find out before calling is_null", you need to call isset *instead of* is_null. Again, ignore the name, and concentrate on what it actually does.
This conversation feels to me like you saying you want a flying car, then complaining because your current car makes a nasty noise when you accelerate for take off in first gear. No matter what you do, your current car won't fly, but if you switch into fifth gear, the noise will go away.
You want a function to test for variable existence, which is a feature PHP does not have; you then jump to talking about not wanting warning noises, which PHP absolutely has the function to avoid.
It is not the noise that is stopping your car flying, so please stop talking about it.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php