php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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
 [2012-09-28 13:16 UTC] lonnyk at gmail dot com
Here is a potential PR for this bug: https://github.com/php/php-src/pull/208
 [2013-04-26 08:07 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 08:01:28 2024 UTC