fix: prevent crash converting UUID timestamps near the Unix epoch
PhpTimeConverter::convertTime() threw an uncaught InvalidArgumentException for v1/v6 UUID timestamps within about 100 microseconds of the Unix epoch (on the pre-1970 side), because PHP renders such small floats in scientific notation, which splitTime() misparsed as a malformed microseconds fragment. splitTime() now recognizes scientific notation and defers to the existing GenericTimeConverter fallback, the same mechanism already used for other precision-loss cases.
This commit is contained in:
1 parent
a27d5edc8f
commit
90c8548448
2 files changed
+15
No files matched your search
@@ -133,6 +133,14 @@ class PhpTimeConverterTest extends TestCase
|
||||
'unixTimestamp' => '0',
|
||||
'microseconds' => '0',
|
||||
],
|
||||
|
||||
// One microsecond before the epoch: PHP renders "-1.0E-6", which must not
|
||||
// be misparsed as microseconds.
|
||||
[
|
||||
'uuidTimestamp' => new Hexadecimal('1b21dd213813ff6'),
|
||||
'unixTimestamp' => '0',
|
||||
'microseconds' => '1',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user