php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37727 isset return a false positive between array key and string
Submitted: 2006-06-07 13:07 UTC Modified: 2006-06-07 13:10 UTC
From: decryptus at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.2 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: decryptus at gmail dot com
New email:
PHP Version: OS:

 

 [2006-06-07 13:07 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-07 13:10 UTC] tony2001@php.net
'bar' is converted to 0 and $foo[0] IS set.
No bug here.
 [2012-03-26 10:21 UTC] joffrey at ne2000 dot nl
A documentation bug (#61507) is filed because the behavior changed from
PHP 5.4.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 04:01:33 2025 UTC