|  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
 [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 Feb 23 14:01:30 2024 UTC