Req #54567 [Com]: DateTimeZone does not serialize
| From: | lonnyk at gmail dot com | Date: | Fri, 28 Sep 2012 13:16:59 +0000 |
| Subject: | Req #54567 [Com]: DateTimeZone does not serialize | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173772@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54567&edit=1
ID: 54567
Comment by: lonnyk at gmail dot com
Reported by: levi at alliancesoftware dot com dot au
Summary: DateTimeZone does not serialize
Status: Open
Type: Feature/Change Request
Package: Date/time related
Operating System: -
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Here is a potential PR for this bug: https://github.com/php/php-src/pull/208
Previous Comments:
------------------------------------------------------------------------
[2011-04-19 07:30:17] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54567&edit=1