|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73113 Segfault with throwing JsonSerializable
Submitted: 2016-09-19 12:09 UTC Modified: 2016-09-19 13:28 UTC
From: nicolas dot grekas+php at gmail dot com Assigned: jpauli (profile)
Status: Closed Package: JSON related
PHP Version: 7.1Git-2016-09-19 (Git) OS:
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: nicolas dot grekas+php at gmail dot com
New email:
PHP Version: OS:


 [2016-09-19 12:09 UTC] nicolas dot grekas+php at gmail dot com
Throwing from jsonSerialize() crashes on PHP 7.1

Test script:

class JsonSerializableObject implements \JsonSerializable
    public function jsonSerialize()
        throw new \Exception('This error is expected');

$obj = new JsonSerializableObject();

echo json_encode($obj);
echo "\n";

Expected result:
an exception

Actual result:
a segfault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-19 13:28 UTC]
-Status: Open +Status: Closed -Package: Scripting Engine problem +Package: JSON related -Assigned To: +Assigned To: jpauli
 [2016-09-19 13:28 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Feb 27 03:01:28 2024 UTC