-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.2.0-alpha2
-
Component/s: None
-
None
PHPC-726 changed the Timestamp and UTCDateTime initialization methods to convert strings to integers and raise exceptions on failure. This process is more strict that PHP's own string-to-integer conversion, as the following fails:
new MongoDB\BSON\UTCDatetime(microtime(true) * 1000);
MongoDB\Driver\Exception\InvalidArgumentException with message 'Error parsing "1473959591217.2" as 64-bit integer for MongoDB\BSON\UTCDateTime initialization'
We should address this before it affects many users that were constructing UTCDateTime for the current time using microtime(), which was necessary before we started defaulting to the current time in 1.2.0-alpha1 (PHPC-536).
Note: There is no practical reason to support truncation of floats for Timestamp arguments.
- related to
-
PHPC-804 Timestamp and UTCDateTime constructors should accept integers in strict types mode
- Closed
- links to