Re: PHP 7.1 - Address PHPSadness #28?
| From: | Michael Wallner | Date: | Wed, 23 Sep 2015 08:38:37 +0000 |
| Subject: | Re: PHP 7.1 - Address PHPSadness #28? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88430@lists.php.net to get a copy of this message | ||
> On 19 09 2015, at 23:22, Rowan Collins <rowan.collins@gmail.com> wrote:
>
> 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.
There is, though, not sure if already mentioned:
array_key_exists(“var”, get_defined_vars()) && is_null($var)