|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-01-27 10:06 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Package: PHP Language Specification
+Package: Scripting Engine problem
-Assigned To:
+Assigned To: nikic
[2018-01-27 10:06 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 10:00:01 2025 UTC |
Description: ------------ When use (array) to convert the object to array, the key will using string even the it is integer, then the string key will never been get. Test script: --------------- $obj = '{"300": {"id": "foo"}}'; $obj = json_decode($obj); $obj = (array)$obj; var_dump($obj); // array (size=1) '300' => string 'foo' (length=3) var_dump($obj["300"]); // null var_dump($obj[300]); // null Expected result: ---------------- It should be convert the object key to integer if it can convert to integer. Actual result: -------------- When convert the object the key will always be string even the key can convert to integer.