Bumping in (senior dev here).
I think this function must be implemented.
Every dev I've seen in my company use isset() as its name says it does :
"Is this variable set, whatever its value is ?". That's exactly how we use
it in the code. And we use "null" a lot too. For us, "null" is a value
like another. The irony is, we set a variable to "null" mostly to avoid
"Undefined variable" notices. To explain it shortly, when we see "$var =
null;", we know that it is a variable that could not be changed in the
scope.
It is logical (at least for us) that "isset()" returns true when a
variable exists, even if its value is "null". I've yet to discover a
security bug in our code, but we have very sensitive applications, in
which we widely use "isset()". It could cause a lot of damages (maybe it
already has, but haven't noticed yet), and "exists()" would prevent them.
Since we have "array_key_exists()", which is basically "exists()" for an
array element, I don't see why "exists()" shouldn't be implemented. I
don't see the logic here.
"isset()" and "empty()" wouldn't change, there couldn't any BC. Excepted
for the userland code, in which there would already be an "exists()"
function.
Regards,
Le Wed, 26 Aug 2015 05:09:43 +0200, Scott Arciszewski
<sc...@paragonie.com> a écrit:
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.
Scott Arciszewski
Chief Development Officer
Paragon Initiative Enterprises <https://paragonie.com>
--
Utilisant le logiciel de courrier d'Opera : http://www.opera.com/mail/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php