Bug #37727 [Com]: isset return a false positive between array key and string
| From: | joffrey at ne2000 dot nl | Date: | Mon, 26 Mar 2012 10:21:15 +0000 |
| Subject: | Bug #37727 [Com]: isset return a false positive between array key and string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168835@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=37727&edit=1
ID: 37727
Comment by: joffrey at ne2000 dot nl
Reported by: decryptus at gmail dot com
Summary: isset return a false positive between array key and
string
Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: *
PHP Version: 4.4.2
Block user comment: N
Private report: N
New Comment:
A documentation bug (#61507) is filed because the behavior changed from
PHP 5.4.
Previous Comments:
------------------------------------------------------------------------
[2006-06-07 13:10:18] tony2001@php.net
'bar' is converted to 0 and $foo[0] IS set.
No bug here.
------------------------------------------------------------------------
[2006-06-07 13:07:03] decryptus at gmail dot com
Description:
------------
There is a problem when I test if an array key exists on a string with the function isset().
isset return true but $foo is not an array and error_reporting doesn't display an error.
Reproduce code:
---------------
$foo = 'foo';
var_dump($foo);
echo '<br />';
var_dump(isset($foo['bar']));
Expected result:
----------------
string(3) "foo"
bool(false)
Actual result:
--------------
string(3) "foo"
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=37727&edit=1