|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2023 The PHP Group
All rights reserved.
Last updated: Sat Feb 04 19:05:50 2023 UTC