|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67502 json_decode accepts wrong strings without syntax error and still decodes
Submitted: 2014-06-23 13:29 UTC Modified: 2014-06-25 18:21 UTC
From: nevil85 at gmail dot com Assigned:
Status: Not a bug Package: JSON related
PHP Version: 5.5.13 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
41 + 33 = ?
Subscribe to this entry?

 [2014-06-23 13:29 UTC] nevil85 at gmail dot com
From manual page:

json_decode accepts wrong strings without syntax error and still decodes

echo json_decode("2014-06-06");
echo json_last_error();

The above code snippet returns 20140. It is a bug, as the error code is 0.

Test script:
echo json_decode("2014-06-06");
echo json_last_error();


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-23 17:30 UTC]
-Status: Open +Status: Feedback
 [2014-06-23 17:30 UTC]
Works for me.
 [2014-06-23 22:04 UTC]
How did you get PHP in the first place — did you compile it from source, or are you using packages? If the latter, which distribution are you on?

I'm wondering if this is an issue with one of the distros that are replacing ext/json for licensing reasons.
 [2014-06-25 14:53 UTC] nevil85 at gmail dot com
-Status: Feedback +Status: Open
 [2014-06-25 14:53 UTC] nevil85 at gmail dot com
You are correct. The bug is available only in a PHP distro, that came with Ubuntu 14 LTS OS.

PHP Version 5.5.9-1ubuntu4

Linux <user> 3.13.0-29-generic #53-Ubuntu SMP <time> x86_64 

Build Date:
Apr 9 2014 17:08:00 

Thanks guys. I really appreciate.
 [2014-06-25 17:11 UTC]
-Status: Open +Status: Not a bug
 [2014-06-25 17:11 UTC]
Closing not a bug; you'll need to report this to the relevant Ubuntu developers at
 [2014-06-25 18:21 UTC]
I will poke Remi about it.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Feb 06 03:03:45 2023 UTC