|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-10-15 09:38 UTC] armin390 at gmail dot com
Description:
------------
When I try to decode a json string that include a key with identifiers,then it will be converted to an invalid propery name.
Test script:
---------------
<?php
$string = '{"test-me+for": "X"}';
var_dump(json_decode($string));
Expected result:
----------------
Fatal error: syntax error, unexpected ...
Actual result:
--------------
object(stdClass)#1 (1) { ["test-me+for"]=> string(1) "X" }
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 06:00:01 2025 UTC |
"test-me+for" is a valid property name in PHP. You can access it using $obj->{"test-me+for"}.