On Wed, Aug 26, 2015 at 5:09 AM, Scott Arciszewski <sc...@paragonie.com> wrote:
> Hi everybody,
>
> Would anyone be interested in adding another helper like
> isset()/empty() simply called exists() which would return true if the
> variable is defined in the current scope (i.e. without raising an
> E_NOTICE)?
>
> It should be a simple change to add this function but it's too late
> for 7.0 so, if there is any interest, I would respectfully put it off
> until 7.1.

After reading through this thread (most of it anyway), the thing that
strikes me is that many people expect the wrong thing from isset(). I
believe that the reason for this is that the name isset() is slightly
misleading. I wouldn't blame anyone for assuming that it acually
checks that a variable "is set", and not even considering the corner
case of when it does exist with a null value.

What lesson can we learn from that? Short and sweet names sometimes
lead to problems, if they do not precisely convey the actual
semantics.

I would much rather see a function called something like
is_variable_defined(), to avoid running into the same trap with
exists(). No room for assumptions that lead you to not check the docs.

 - Stig

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

Reply via email to