|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-12-17 14:25 UTC] bjori@php.net
[2009-03-10 23:57 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
Description: ------------ Attempts to use a DateTime object that has been serialized/unserialized produces an error. Reproduce code: --------------- <?php $dttNow = new DateTime('now'); print $dttNow->format(DateTime::ISO8601) . '<br/>'; $strSerialized = serialize($dttNow); $dttRestored = unserialize($strSerialized); print $dttRestored->format(DateTime::ISO8601) . '<br/>'; ?> Expected result: ---------------- 2006-12-13T12:26:39-0800 2006-12-13T12:26:39-0800 Actual result: -------------- 2006-12-13T12:26:39-0800 Warning: DateTime::format() [function.DateTime-format]: The DateTime object has not been correctly initialized by its constructor in /home/wcc/wwwroot/test.php on line 7