|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71718 json_decode produce error when decoding null
Submitted: 2016-03-05 17:19 UTC Modified: 2016-03-05 17:46 UTC
From: noskov dot vlad at gmail dot com Assigned:
Status: Not a bug Package: JSON related
PHP Version: 7.0.4 OS: Darwin Kernel Version 15.3.0
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:
21 + 12 = ?
Subscribe to this entry?

 [2016-03-05 17:19 UTC] noskov dot vlad at gmail dot com
Starting from v.7.0  after calling json_decode(null), json_last_error() return JSON_ERROR_SYNTAX. For earlier versions it return 0.

Test script:


Expected result:
json_last_error() return 0

Actual result:
json_last_error() return JSON_ERROR_SYNTAX


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-05 17:46 UTC]
-Status: Open +Status: Not a bug
 [2016-03-05 17:46 UTC]
This is an intentional change. null interpreted as a string is "", and that's not valid JSON.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Feb 07 13:05:49 2023 UTC