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 (profile)
Status: Closed Package: JSON related
PHP Version: 7.1Git-2016-09-19 (Git) OS:
Private report: No CVE-ID: None
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 09:01:26 2024 UTC