Skip to content

Commit 1c2680b

Browse files
macghriogairPatrick Mac Gregor
authored andcommitted
[module-webdriver] fix type error in PHP 8.1 when converting ms to sec (#103)
* [module-webdriver] fix type error in PHP 8.1 when converting milliseconds to seconds * simplify using intval Co-authored-by: Patrick Mac Gregor <[email protected]>
1 parent 14718a2 commit 1c2680b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Codeception/Module/WebDriver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ protected function formatLogEntries(array $logEntries): string
708708

709709
foreach ($logEntries as $logEntry) {
710710
// Timestamp is in milliseconds, but date() requires seconds.
711-
$time = date('H:i:s', $logEntry['timestamp'] / 1000) .
711+
$time = date('H:i:s', intval($logEntry['timestamp'] / 1000)) .
712712
// Append the milliseconds to the end of the time string
713713
'.' . ($logEntry['timestamp'] % 1000);
714714
$formattedLogs .= "{$time} {$logEntry['level']} - {$logEntry['message']}\n";
@@ -729,7 +729,7 @@ protected function logJSErrors(ScenarioDriven $test, array $browserLogEntries):
729729
&& $this->isJSError($logEntry['level'], $logEntry['message'])
730730
) {
731731
// Timestamp is in milliseconds, but date() requires seconds.
732-
$time = date('H:i:s', $logEntry['timestamp'] / 1000) .
732+
$time = date('H:i:s', intval($logEntry['timestamp'] / 1000)) .
733733
// Append the milliseconds to the end of the time string
734734
'.' . ($logEntry['timestamp'] % 1000);
735735
$test->getScenario()->comment("{$time} {$logEntry['level']} - {$logEntry['message']}");

0 commit comments

Comments
 (0)