From 3b96bc20e3e09217891cfbe1188d75d468094bdc Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 13 Nov 2023 15:22:35 +0100 Subject: [PATCH] String replace last occurrence of output Fixes bug where port numbers containing matches got coloured --- packages/realtime-compiler/src/ConsoleOutput.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/realtime-compiler/src/ConsoleOutput.php b/packages/realtime-compiler/src/ConsoleOutput.php index 799aa5ae7aa..50976736f58 100644 --- a/packages/realtime-compiler/src/ConsoleOutput.php +++ b/packages/realtime-compiler/src/ConsoleOutput.php @@ -111,7 +111,7 @@ protected function formatRequestLine(string $line): string $statusCode = Str::between($message, ' [', ']:'); if ($statusCode >= 400) { - $message = str_replace($statusCode, sprintf('%s', $statusCode), $message); + $message = Str::replaceLast($statusCode, sprintf('%s', $statusCode), $message); $iconColor = 'yellow-500'; }