|  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: noskov dot vlad at gmail dot com
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 05:01:29 2024 UTC