Skip to content

Commit e0aa26c

Browse files
macghriogairPatrick Mac Gregor
and
Patrick Mac Gregor
authored
[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 <patrick.macgregor@foo.ag>
1 parent 57e2d83 commit e0aa26c

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
@@ -698,7 +698,7 @@ protected function formatLogEntries(array $logEntries): string
698698

699699
foreach ($logEntries as $logEntry) {
700700
// Timestamp is in milliseconds, but date() requires seconds.
701-
$time = date('H:i:s', $logEntry['timestamp'] / 1000) .
701+
$time = date('H:i:s', intval($logEntry['timestamp'] / 1000)) .
702702
// Append the milliseconds to the end of the time string
703703
'.' . ($logEntry['timestamp'] % 1000);
704704
$formattedLogs .= "{$time} {$logEntry['level']} - {$logEntry['message']}\n";
@@ -718,7 +718,7 @@ protected function logJSErrors(ScenarioDriven $test, array $browserLogEntries):
718718
&& $this->isJSError($logEntry['level'], $logEntry['message'])
719719
) {
720720
// Timestamp is in milliseconds, but date() requires seconds.
721-
$time = date('H:i:s', $logEntry['timestamp'] / 1000) .
721+
$time = date('H:i:s', intval($logEntry['timestamp'] / 1000)) .
722722
// Append the milliseconds to the end of the time string
723723
'.' . ($logEntry['timestamp'] % 1000);
724724
$test->getScenario()->comment("{$time} {$logEntry['level']} - {$logEntry['message']}");

0 commit comments

Comments
 (0)