Bug #72584 [NEW]: Exception::__toString() fails after unserialize().
| From: | sb at vestergaardcompany dot com | Date: | Tue, 12 Jul 2016 13:34:23 +0000 |
| Subject: | Bug #72584 [NEW]: Exception::__toString() fails after unserialize(). | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-202237@lists.php.net to get a copy of this message | ||
From: sb at vestergaardcompany dot com
Operating system: Linux
PHP version: Irrelevant
Package: Class/Object related
Bug Type: Bug
Bug description:Exception::__toString() fails after unserialize().
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 bug report at https://bugs.php.net/bug.php?id=72584&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72584&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72584&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72584&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72584&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72584&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72584&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72584&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72584&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72584&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72584&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72584&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72584&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72584&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72584&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72584&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72584&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72584&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72584&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72584&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72584&r=mysqlcfg