From: php at michaelho dot com Operating system: Mac OS X 10.4.7 PHP version: 5.2.0 PHP Bug Type: Date/time related Bug description: Unable to Serialize and then Unserialize a PHP DateTime Object
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 -- Edit bug report at http://bugs.php.net/?id=39821&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39821&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39821&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39821&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39821&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39821&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39821&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39821&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39821&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39821&r=support Expected behavior: http://bugs.php.net/fix.php?id=39821&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39821&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39821&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39821&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39821&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39821&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39821&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39821&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39821&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39821&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39821&r=mysqlcfg