php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72581 previous property undefined in Exception after deserialization
Submitted: 2016-07-11 21:57 UTC Modified: -
From: maciej dot k dot mrozinski at gmail dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 5.6.23 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2016-07-11 21:57 UTC] maciej dot k dot mrozinski at gmail dot com
Description:
------------
After serialization and deserialization, Exception object have previous property undefined which is not the case before serialization.

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

$e = new Exception('aaa', 200);

var_dump($e->__toString());

$a = serialize($e);

$b = unserialize($a);

var_dump($b->__toString());

Expected result:
----------------
string(162) "exception 'Exception' with message 'aaa' in [...][...]:3
Stack trace:
#0 {main}"
string(162) "exception 'Exception' with message 'aaa' in [...][...]:3
Stack trace:
#0 {main}"


Actual result:
--------------
string(162) "exception 'Exception' with message 'aaa' in [...][...]:3
Stack trace:
#0 {main}"
<br />
<b>Notice</b>:  Undefined property: Exception::$previous in <b>[...][...]</b> on line <b>11</b><br />
string(162) "exception 'Exception' with message 'aaa' in [...][...]:3
Stack trace:
#0 {main}"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-12 03:53 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=42902919bc0f97977e116415c9968dc6b23b12d2
Log: Fixed bug #72581 (previous property undefined in Exception after deserialization)
 [2016-07-12 03:53 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:30 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=42902919bc0f97977e116415c9968dc6b23b12d2
Log: Fixed bug #72581 (previous property undefined in Exception after deserialization)
 [2016-10-17 10:11 UTC] bwoebi@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=42902919bc0f97977e116415c9968dc6b23b12d2
Log: Fixed bug #72581 (previous property undefined in Exception after deserialization)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC