note 106766 added to function.json-decode
| From: | KP at osu1 dot php dot net | Date: | Mon, 05 Dec 2011 16:12:56 +0000 |
| Subject: | note 106766 added to function.json-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184902@lists.php.net to get a copy of this message | ||
Hi,
I just wanted to bring to your attention how that json_decode fails when you have a number with a
value under 1 and preceding zero is not populated.
This is not a bug as it violates JSON spec.
I had to make sure that number is preceded with a zero.
To test that
$json = json_decode('{"a":0.1,"b":-0.1}');
echo json_last_error();
$json = json_decode('{"a":-.1,"b":.1}');
echo json_last_error();
----
Server IP: 69.147.83.197
Probable Submitter: 193.173.23.201
----
Manual Page -- http://www.php.net/manual/en/function.json-decode.php
Edit -- https://master.php.net/note/edit/106766
Del: integrated -- https://master.php.net/note/delete/106766/integrated
Del: useless -- https://master.php.net/note/delete/106766/useless
Del: bad code -- https://master.php.net/note/delete/106766/bad+code
Del: spam -- https://master.php.net/note/delete/106766/spam
Del: non-english -- https://master.php.net/note/delete/106766/non-english
Del: in docs -- https://master.php.net/note/delete/106766/in+docs
Del: other reasons-- https://master.php.net/note/delete/106766
Reject -- https://master.php.net/note/reject/106766
Search -- https://master.php.net/manage/user-notes.php