#26413 [Opn]: isset of array index of a non-array returns incorrectly

From: Date: Tue, 25 Nov 2003 20:00:47 +0000
Subject: #26413 [Opn]: isset of array index of a non-array returns incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51023@lists.php.net to get a copy of this message
 ID:               26413
 User updated by:  james at gogo dot co dot nz
 Reported By:      james at gogo dot co dot nz
 Status:           Open
-Bug Type:         Reproducible crash
+Bug Type:         Scripting Engine problem
 Operating System: Linux mortimer 2.4.20 #1 Sat Aug
 PHP Version:      4.3.3
 New Comment:

Put this in wrong category


Previous Comments:
------------------------------------------------------------------------

[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


Thread (5 messages)

« previous php.bugs (#51023) next »