Date: 03/26/99
- Next message: mb <email protected>: "[PHP-DEV] Bug #1270: no warning when trying to overwrite define/no undefine!?"
- Previous message: arneodo <email protected>: "[PHP-DEV] Bug #1269: is_array function defines the variable?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 1269
Updated by: zeev
Reported By: arneodo <email protected>
Status: Closed
Bug Type: Misbehaving function
Assigned To:
Comments:
is_array() doesn't create the variable, it is created before
the call to is_array(), and passed to it. You need to understand
how PHP's automatic declaration of variables work.
In essence:
As soon as you reference a variable, it is automatically defined.
For example, if you pass a variable to is_array(), like you have
in your example, PHP checks out whether it exists, if it doesn't -
it creates it, and then it passes it over to is_array(). It has
to pass *something*, that's why the variable is automatically defined.
The implementation of is_array() has nothing to do with this
behavior - each and every function in PHP would behave in the same
way.
There aren't too many exceptions to this case, basically, only
three special functions may reference a variable without causing
it to be implicitly declared - those are unset(), isset() and empty().
Full Bug description available at: http://ca.php.net/bugs.php3?id=1269
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: mb <email protected>: "[PHP-DEV] Bug #1270: no warning when trying to overwrite define/no undefine!?"
- Previous message: arneodo <email protected>: "[PHP-DEV] Bug #1269: is_array function defines the variable?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

