note 53176 deleted from function.isset by googleguy
| From: | googleguy@php.net | Date: | Tue, 15 Jan 2013 04:47:27 +0000 |
| Subject: | note 53176 deleted from function.isset by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193057@lists.php.net to get a copy of this message | ||
Note Submitter: darkstar_ae at hotmail dot com
----
isset doesn't reliably evaluate variables with blank strings (not necessarily NULL).
i.e.
$blankvar = ""; // isset will return true on this.
This is a very common pitfall when handling HTML forms that return blank text fields to the script.
You're better off doing this:
if ($var != "")
return true;
else
return false;
This more of a programming practice rather than the function's shortcomings. So if you have a
habit of initializing variables you're likely to run into problems with isset() if your code or
php project become very large.