-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.1.4
-
Component/s: None
-
None
-
Environment:PHP 5.6.14
pecl-mongodb v1.1.4
This issue manifests itself when attempting to round-trip the exported DateTime value through PHP serialization. Here, we would expect the microseconds to be "234000" instead of "234000000". Likewise, the "date" string should only be 26 characters long.
$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
- links to