-
Notifications
You must be signed in to change notification settings - Fork 209
Closed
Labels
Description
If you try to serialize a DateTime object generated from UTCDateTime::toDateTime, that serialized object throws an error when you try to unserialize it. Looks like may be related to the decimal part of the timestamp.
PHP 5.6.14
pecl-mongodb v1.1.4
Example
$udt = new MongoDB\BSON\UTCDateTime((time() * 1000) + 1234);
$d = $udt->toDateTime();
$s = serialize($d);
print("$s\n");
print_r(unserialize($s));
Output
O:8:"DateTime":3:{s:4:"date";s:29:"2016-03-11 22:04:02.234000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+00:00";}
PHP Fatal error: Invalid serialization data for DateTime object in Command line code on line 1
Fatal error: Invalid serialization data for DateTime object in Command line code on line 1
ravanscafi