From 095bf11b27a5b044d71540abe5c02a477139f640 Mon Sep 17 00:00:00 2001 From: angeljqv <79208641+angeljqv@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:02:18 -0500 Subject: [PATCH] Normalize DIRECTORY_SEPARATOR on file traces(exceptions) (#1980) --- src/Monolog/Formatter/LineFormatter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Monolog/Formatter/LineFormatter.php b/src/Monolog/Formatter/LineFormatter.php index d26204a3..d44e7aef 100644 --- a/src/Monolog/Formatter/LineFormatter.php +++ b/src/Monolog/Formatter/LineFormatter.php @@ -278,7 +278,7 @@ class LineFormatter extends NormalizerFormatter $file = preg_replace('{^'.preg_quote($this->basePath).'}', '', $file); } - $str .= '): ' . $e->getMessage() . ' at ' . $file . ':' . $e->getLine() . ')'; + $str .= '): ' . $e->getMessage() . ' at ' . strtr((string) $file, DIRECTORY_SEPARATOR, '/') . ':' . $e->getLine() . ')'; if ($this->includeStacktraces) { $str .= $this->stacktracesParser($e); @@ -307,7 +307,7 @@ class LineFormatter extends NormalizerFormatter return ''; } - return "\n{$this->indentStacktraces}[stacktrace]\n{$this->indentStacktraces}" . $trace . "\n"; + return "\n{$this->indentStacktraces}[stacktrace]\n{$this->indentStacktraces}" . strtr($trace, DIRECTORY_SEPARATOR, '/') . "\n"; } private function stacktracesParserCustom(string $trace): string