|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-10-31 10:43 UTC] danack@php.net
[2019-10-31 10:44 UTC] requinix@php.net
-Status: Open
+Status: Feedback
-Type: Bug
+Type: Feature/Change Request
[2019-10-31 10:44 UTC] requinix@php.net
[2019-10-31 10:53 UTC] cmb@php.net
[2019-11-10 04:22 UTC] php-bugs at lists dot php dot net
[2019-11-10 04:26 UTC] requinix@php.net
-Status: No Feedback
+Status: Open
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 11:00:02 2025 UTC |
Description: ------------ Duplicate key names are not allowed in the JSON format. If a json string containing duplicate keys is decoded with json_decode, json_decode simple overwrites the existing key. Just like json_encode returns NULL for other invalid JSON strings, could such an input also be treated as invalid? Maybe as an optional check as this is just a rare condition? Test script: --------------- <?php echo var_export(json_decode('{"a":"b","a":"c"}'),1); ?> Expected result: ---------------- NULL or an exception Actual result: -------------- stdClass::__set_state(array( 'a' => 'c', ))