PHP :: Request #54567 :: DateTimeZone does not serialize

Request #54567 DateTimeZone does not serialize
Submitted: 2011-04-19 07:30 UTC Modified: 2013-04-26 08:07 UTC
Votes:7
Avg. Score:4.0 ± 0.9
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:1 (16.7%)
From: levi at alliancesoftware dot com dot au Assigned: nikic (profile)
Status: Closed Package: Date/time related
PHP Version: 5.3.6 OS: -
Private report: No CVE-ID: None

 [2011-04-19 07:30 UTC] levi at alliancesoftware dot com dot au

Description:
------------
http://bugs.php.net/bug.php?id=41334 -- DateTime serialization was added in PHP 5.3, but DateTimeZone still serializes to an empty object, it's serialized string is always:

O:12:"DateTimeZone":0:{}

Test script:
---------------
<?
$x = new DateTimeZone('Australia/Victoria');
echo $x->getName()."\n";
$x = serialize($x);
$x = unserialize($x);
echo $x->getName()."\n";
?>


Expected result:
----------------
Australia/Victoria
Australia/Victoria

Actual result:
--------------
Australia/Victoria
PHP Warning:  DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in - on line 7

Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in - on line 7

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2013-04-26 08:07 UTC] nikic@php.net

-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic