|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-04-08 08:20 UTC] scottmac@php.net
[2011-04-08 09:59 UTC] aharvey@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: scottmac
[2011-06-01 11:44 UTC] iliaa@php.net
[2011-06-01 11:44 UTC] iliaa@php.net
-Status: Assigned
+Status: Closed
-Assigned To: scottmac
+Assigned To: iliaa
[2011-06-01 11:44 UTC] iliaa@php.net
[2012-04-18 09:50 UTC] laruence@php.net
[2012-07-24 23:41 UTC] rasmus@php.net
[2012-10-22 02:35 UTC] aharvey@php.net
[2012-10-22 02:35 UTC] aharvey@php.net
-Status: Closed
+Status: Re-Opened
-Assigned To: iliaa
+Assigned To: aharvey
[2013-11-17 09:37 UTC] laruence@php.net
[2013-11-17 09:37 UTC] laruence@php.net
-Status: Re-Opened
+Status: Closed
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 18:00:01 2025 UTC |
Description: ------------ If you decode an empty json value, the internal error state doesn't change. Decode a valid json value and after that an empty value, the error state is 0 Decode an invalid json value and after that an empty value, the error state remains 4 (JSON_ERROR_SYNTAX) (I think it's the same for all error states, but haven't actually tested) I'm not quite sure whether an empty string is valid json and should reset the error state to 0 or whether it is invalid json and should set the error state to 4. Because a valid empty json string is '""' and not '' Test script: --------------- <?php error_reporting(E_ALL); json_decode('{"test":"test"}'); var_dump(json_last_error()); json_decode(""); var_dump(json_last_error()); json_decode("invalid json"); var_dump(json_last_error()); json_decode(""); var_dump(json_last_error()); ?> Expected result: ---------------- int(0) int(0) int(4) int(0) OR int(0) int(4) int(4) int(4) Actual result: -------------- int(0) int(0) int(4) int(4)