Bug #72584 [Opn->Dup]: Exception::__toString() fails after unserialize().
Edit report at https://bugs.php.net/bug.php?id=72584&edit=1
ID: 72584
Updated by: requinix@php.net
Reported by: sb at vestergaardcompany dot com
Summary: Exception::__toString() fails after unserialize().
-Status: Open
+Status: Duplicate
Type: Bug
Package: Class/Object related
Operating System: Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Already fixed with bug #72581.
Previous Comments:
------------------------------------------------------------------------
[2016-07-12 13:34:20] sb at vestergaardcompany dot com
Description:
------------
It seems that if an Exception object is serialized and unserialized, the resulting object does not
have the private "previous" property set correctly.
Invoking the __toString method on the resulting object generates a PHP Notice.
Test script:
---------------
<?php
$e1 = new Exception("Test");
$e2 = unserialize( serialize( $e1 ) );
echo $e2->__toString() . "\n";
?>
Expected result:
----------------
exception 'Exception' with message 'Test' in /home/...php:2
Stack trace:
#0 {main}
Actual result:
--------------
PHP Notice: Undefined property: Exception::$previous in /home/...php on line 4
PHP Stack trace:
PHP 1. {main}() /home/...php:0
PHP 2. Exception->__toString() /home/...php:4
exception 'Exception' with message 'Test' in /home/...php:2
Stack trace:
#0 {main}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72584&edit=1
Thread (2 messages)