|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72217 json_decode not working correctly.
Submitted: 2016-05-14 10:20 UTC Modified: 2016-05-15 15:20 UTC
From: b dot bendeliani at gmail dot com Assigned:
Status: Duplicate Package: JSON related
PHP Version: 7.0.6 OS: CentOS
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: b dot bendeliani at gmail dot com
New email:
PHP Version: OS:


 [2016-05-14 10:20 UTC] b dot bendeliani at gmail dot com
I'm had this script in older version of php and there was not any error. When I upgraded to PHP 7.0.6 this problem occurred. 

Test script:
class Json implements JsonSerializable
    public function jsonSerialize()

        return ["test" => "test"];

$test = new Json;

header('Content-Type: application/json');
echo json_encode($test);

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-14 10:24 UTC] b dot bendeliani at gmail dot com
-Summary: json_decode now working correctly. +Summary: json_decode not working correctly.
 [2016-05-14 10:24 UTC] b dot bendeliani at gmail dot com
spelling correction.
 [2016-05-15 15:09 UTC]
-Package: json +Package: JSON related
 [2016-05-15 15:19 UTC]
-Status: Open +Status: Duplicate
 [2016-05-15 15:19 UTC]
This is duplicate (from the internal point of view) of and it has been fixed by .
 [2016-05-15 15:20 UTC]
Should be part of 7.0.7
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 12:01:25 2019 UTC