Edit report at https://bugs.php.net/bug.php?id=62292&edit=1
ID: 62292
Comment by: p dot scheit at ps-webforge dot com
Reported by: hosiplan at gmail dot com
Summary: Casting object to array brokes isset on numerical
keys
Status: Open
Type: Bug
Package: Class/Object related
Operating System: Linux
PHP Version: 5.3.13
Block user comment: N
Private report: N
New Comment:
this seems to be a possible duplicate of https://bugs.php.net/bug.php?id=45959
Previous Comments:
------------------------------------------------------------------------
[2012-06-11 13:56:18] hosiplan at gmail dot com
Description:
------------
Casting object to array brokes isset on numerical keys
Test script:
---------------
$obj = json_decode('{"100":[10],"120":[20]}');
$map = (array)$obj;
var_dump(
isset($obj->{100}),
isset($obj->{"100"}),
isset($map[100]),
isset($map["100"])
);
Expected result:
----------------
bool(false)
bool(true)
bool(false)
bool(true)
Actual result:
--------------
bool(true)
bool(true)
bool(false)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62292&edit=1