Edit report at https://bugs.php.net/bug.php?id=62724&edit=1

 ID:                 62724
 User updated by:    max at kriegt dot es
 Reported by:        max at kriegt dot es
 Summary:            isset returns false but array_key_exists returns
                     true (int keys)
 Status:             Not a bug
 Type:               Bug
 Package:            Arrays related
 Operating System:   Debian 6
 PHP Version:        5.4.5
 Block user comment: N
 Private report:     N

 New Comment:

Hm - misinterpreted the function. :/


Previous Comments:
------------------------------------------------------------------------
[2012-08-02 09:46:01] ahar...@php.net

What Keith said. :)

------------------------------------------------------------------------
[2012-08-02 09:43:38] keithm at aoeex dot com

This is not a bug.  From the manual page on isset:
"Determine if a variable is set and is not NULL."

In your example, $foo[0] is null which is why isset returns false.

------------------------------------------------------------------------
[2012-08-02 09:36:54] max at kriegt dot es

Description:
------------
Hi,

recently realized that isset not returning the same result as array_key_exists 
does for int-Keys.

Test script:
---------------
<?php
$foo = array(null);

var_dump( isset($foo[0]), array_key_exists(0, $foo) );

Expected result:
----------------
bool(true)
bool(true)

Actual result:
--------------
bool(false)
bool(true)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62724&edit=1

Reply via email to