php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52313 Missing JSON_ERROR_STATE_MISMATCH in json_last_error() documentation
Submitted: 2010-07-12 10:51 UTC Modified: 2010-08-10 02:44 UTC
From: jerome dot auge at anakeen dot com Assigned: philip (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.2 OS:
Private report: No CVE-ID: None
 [2010-07-12 10:51 UTC] jerome dot auge at anakeen dot com
Description:
------------
The json_last_error() documentation lacks the JSON_ERROR_STATE_MISMATCH constant 
in the list of possible returned values.

Test script:
---------------
The error code '2' returned by a json_decode() of a malformed JSON string (Ex. '{"foo":"bar"}}' with double '}' at end) is not known by the constants shown in the documentation.

A glimpse in the source code, shows that there is another constant 'JSON_ERROR_STATE_MISMATCH' that matches the error code '2'.

Expected result:
----------------
--8<--
JSON_ERROR_NONE	No error has occurred	 
JSON_ERROR_DEPTH	The maximum stack depth has been exceeded	 
JSON_ERROR_STATE_MISMATCH	Invalid or malformed JSON
JSON_ERROR_CTRL_CHAR	Control character error, possibly incorrectly encoded	 
JSON_ERROR_SYNTAX	Syntax error	 
JSON_ERROR_UTF8	Malformed UTF-8 characters, possibly incorrectly encoded	
PHP 5.3.1
-->8--


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-10 02:43 UTC] philip@php.net
Automatic comment from SVN on behalf of philip
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=302054
Log: Improved wording to describe JSON_ERROR_STATE_MISMATCH, as per PHP bug #52313 (via jerome dot auge at anakeen dot com)
 [2010-08-10 02:44 UTC] philip@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: philip
 [2010-08-10 02:44 UTC] philip@php.net
Fixed in SVN, thanks for the report! :) The fix will show up online this upcoming 
Friday. Also, this is related to PHP bug #52391
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 20:00:02 2026 UTC