|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26413 isset of array index of a non-array returns incorrectly
Submitted: 2003-11-25 14:59 UTC Modified: 2003-11-25 17:43 UTC
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: james at gogo dot co dot nz Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4CVS 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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: james at gogo dot co dot nz
New email:
PHP Version: OS:


 [2003-11-25 14:59 UTC] james at gogo dot co dot nz
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:
	$foo = '4';
		echo "Uh Oh";
            echo "S'all Good";

Expected result:
S'all Good

Actual result:
Uh Oh


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-25 15:08 UTC]
Works fine with PHP 5 btw. (this fails also with 4.2.3, so this is old issue)

 [2003-11-25 15:38 UTC]
This is fixed in PHP 5.0, but for backwards compatibility reasons it'll remain as is in PHP 4.
 [2003-11-25 17:43 UTC] james at gogo dot co dot nz
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).
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Sep 29 14:05:55 2022 UTC