note 17265 added to migration4.empty
| From: | alan at frostick dot de | Date: | Sun, 02 Dec 2001 15:01:35 +0000 |
| Subject: | note 17265 added to migration4.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21530@lists.php.net to get a copy of this message | ||
The changes to empty() also affect isset() in a similar way.
Under php3:
$foo=""; isset($foo) returned false..
but under php4 it returns true, because the variable is defined.
I discovered this when converting other people's code to php4. They used isset() unnecessarily
- with the implicit expectation it just tested the value of the variable as being non-null. Although
I don't agree with sloppy coding, it can give an unexpected shock when run under php4 and so
any uses of isset() should be searched for before you attempt to migrate.
--
http://www.php.net/manual/en/migration4.empty.php
http://master.php.net/manage/user-notes.php?action=edit+17265
http://master.php.net/manage/user-notes.php?action=delete+17265
http://master.php.net/manage/user-notes.php?action=reject+17265