Skip to content

Commit 19c3c7a

Browse files
author
Alex Westergaard
committed
Fix PHP interpret intval("1_000_000") as 1 and not 1000000
1 parent d9a257e commit 19c3c7a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Analytics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function setUserId(string $id)
8484
*/
8585
public function setTimestamp($microOrUnix)
8686
{
87-
$secondInMicro = intval('1_000_000');
87+
$secondInMicro = intval(strtr('1_000_000', ['_' => '']));
8888
$offsetLimit = strtotime('-3 days') * $secondInMicro;
8989

9090
if (!is_numeric($microOrUnix)) {

test/AnalyticsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testTimeIsMicrotime()
5151

5252
$arr = $this->analytics->toArray();
5353

54-
$this->assertTrue($arr['timestamp_micros'] > intval('1_000_000'));
54+
$this->assertTrue($arr['timestamp_micros'] > intval(strtr('1_000_000', ['_' => ''])));
5555
}
5656

5757
public function testExceptionIfTimeOlderThanOffsetLimit()

0 commit comments

Comments
 (0)