Skip to content

Commit 1b6d082

Browse files
committed
Remove workaround for floats (caused by using x86 binary)
1 parent cad4f42 commit 1b6d082

1 file changed

Lines changed: 15 additions & 22 deletions

File tree

src/main/php/util/UUID.class.php

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -152,28 +152,21 @@ public static function timeUUID() {
152152
$clock_seq= random_int(0, 2147483647);
153153
$h= md5(php_uname());
154154

155-
// Prevent "Implicit conversion from float (...) to int loses precision" in 8.5+
156-
// TODO: This should really be fixed by using the bcmath functions if available!
157-
set_error_handler(null);
158-
try {
159-
return new self([
160-
1,
161-
$t & 0xFFFFFFFF,
162-
($t >> 32) & 0xFFFF,
163-
($t >> 48) & 0x0FFF,
164-
$clock_seq,
165-
[
166-
hexdec(substr($h, 0x0, 2)),
167-
hexdec(substr($h, 0x2, 2)),
168-
hexdec(substr($h, 0x4, 2)),
169-
hexdec(substr($h, 0x6, 2)),
170-
hexdec(substr($h, 0x8, 2)),
171-
hexdec(substr($h, 0xB, 2))
172-
]
173-
]);
174-
} finally {
175-
restore_error_handler();
176-
}
155+
return new self([
156+
1,
157+
$t & 0xFFFFFFFF,
158+
($t >> 32) & 0xFFFF,
159+
($t >> 48) & 0x0FFF,
160+
$clock_seq,
161+
[
162+
hexdec(substr($h, 0x0, 2)),
163+
hexdec(substr($h, 0x2, 2)),
164+
hexdec(substr($h, 0x4, 2)),
165+
hexdec(substr($h, 0x6, 2)),
166+
hexdec(substr($h, 0x8, 2)),
167+
hexdec(substr($h, 0xB, 2))
168+
]
169+
]);
177170
}
178171

179172
/**

0 commit comments

Comments
 (0)