php.net |  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
Status: Closed Package: JSON related
PHP Version: 7.1Git-2016-09-19 (Git) OS:
Private report: No CVE-ID:
 [2016-09-19 12:09 UTC] nicolas dot grekas+php at gmail dot com
Description:
------------
Throwing from jsonSerialize() crashes on PHP 7.1

Test script:
---------------
<?php

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-19 13:28 UTC] jpauli@php.net
-Status: Open +Status: Closed -Package: Scripting Engine problem +Package: JSON related -Assigned To: +Assigned To: jpauli
 [2016-09-19 13:28 UTC] jpauli@php.net
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
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue May 30 09:02:04 2017 UTC