Jelajahi Sumber

Normalize DIRECTORY_SEPARATOR on file traces(exceptions) (#1980)

angeljqv 2 bulan lalu
induk
melakukan
095bf11b27
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      src/Monolog/Formatter/LineFormatter.php

+ 2 - 2
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