Bug #62292 [Opn->Dup]: Casting object to array brokes isset on numerical keys
| From: | ajf@php.net | Date: | Wed, 23 Dec 2015 23:13:05 +0000 |
| Subject: | Bug #62292 [Opn->Dup]: Casting object to array brokes isset on numerical keys | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198184@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62292&edit=1
ID: 62292
Updated by: ajf@php.net
Reported by: hosiplan at gmail dot com
Summary: Casting object to array brokes isset on numerical
keys
-Status: Open
+Status: Duplicate
Type: Bug
Package: Class/Object related
Operating System: Linux
PHP Version: 5.3.13
Block user comment: N
Private report: N
New Comment:
Duplicate of https://bugs.php.net/bug.php?id=66173
Previous Comments:
------------------------------------------------------------------------
[2013-05-23 09:57:13] p dot scheit at ps-webforge dot com
this seems to be a possible duplicate of https://bugs.php.net/bug.php?id=45959
------------------------------------------------------------------------
[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