Re: PHP 7.1 - Address PHPSadness #28?

From: Date: Tue, 15 Sep 2015 17:04:11 +0000
Subject: Re: PHP 7.1 - Address PHPSadness #28?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-88219@lists.php.net to get a copy of this message
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 <scott@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/

« previous php.internals (#88219) next »