Fix broken conversion of microseconds less than 100000. #1381
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dates with microsecond values less than 100000 are not correctly converted to PHP objects.
When converting from MongoDate objects, the
usec
field returns an integer that is concatenated directly to a string formated date incraftDateTime
. For example, the value 1.0001 gets split into 1 second and 100 microseconds, which then gets concatenated as "1.100".When converting numeric values, the sub-seconds are broken into a string which is then padded to six values; however, it is casted to an int first. For example, 1.0001 gets split into a string "0001" which is cast to the integer 1 and padded to "100000", resulting in "1.100000".
In order to properly convert microseconds, they are string padded without converting to an integer.