From 1c2680b9f6584bb0413c56087eb0613e7b61afb0 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 27 Jul 2022 11:06:49 +0200 Subject: [PATCH] [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 --- src/Codeception/Module/WebDriver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Codeception/Module/WebDriver.php b/src/Codeception/Module/WebDriver.php index 1c5e7e6..5d23d45 100644 --- a/src/Codeception/Module/WebDriver.php +++ b/src/Codeception/Module/WebDriver.php @@ -708,7 +708,7 @@ protected function formatLogEntries(array $logEntries): string foreach ($logEntries as $logEntry) { // Timestamp is in milliseconds, but date() requires seconds. - $time = date('H:i:s', $logEntry['timestamp'] / 1000) . + $time = date('H:i:s', intval($logEntry['timestamp'] / 1000)) . // Append the milliseconds to the end of the time string '.' . ($logEntry['timestamp'] % 1000); $formattedLogs .= "{$time} {$logEntry['level']} - {$logEntry['message']}\n"; @@ -729,7 +729,7 @@ protected function logJSErrors(ScenarioDriven $test, array $browserLogEntries): && $this->isJSError($logEntry['level'], $logEntry['message']) ) { // Timestamp is in milliseconds, but date() requires seconds. - $time = date('H:i:s', $logEntry['timestamp'] / 1000) . + $time = date('H:i:s', intval($logEntry['timestamp'] / 1000)) . // Append the milliseconds to the end of the time string '.' . ($logEntry['timestamp'] % 1000); $test->getScenario()->comment("{$time} {$logEntry['level']} - {$logEntry['message']}");