ID: 26413
User updated by: james at gogo dot co dot nz
Reported By: james at gogo dot co dot nz
Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 4CVS
New Comment:
How is it a compatability problem to fix this?
I don't see how a person would use the incorrect true result for
anything useful? It's seems it would be silly for anything to do
anything with the result of that test, as it could mean either the
element exists (and isn't null) or the element cannot exist at all
(because the variable is not an array).
Previous Comments:
------------------------------------------------------------------------
[2003-11-25 15:38:55] [EMAIL PROTECTED]
This is fixed in PHP 5.0, but for backwards compatibility reasons it'll
remain as is in PHP 4.
------------------------------------------------------------------------
[2003-11-25 15:08:49] [EMAIL PROTECTED]
Works fine with PHP 5 btw. (this fails also with 4.2.3, so this is old
issue)
------------------------------------------------------------------------
[2003-11-25 14:59:18] james at gogo dot co dot nz
Description:
------------
Using isset to test for the existance of an array index on a non array
(in this case string '4') returns true, when plainly, $foo has no
element indexed 'bar';
Reproduce code:
---------------
<?php
$foo = '4';
if(isset($foo['bar']))
{
echo "Uh Oh";
}
else
{
echo "S'all Good";
}
?>
Expected result:
----------------
S'all Good
Actual result:
--------------
Uh Oh
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26413&edit=1