From 8b7b8940ab2692fb526e1a0cb5d561fd51a0ae3b Mon Sep 17 00:00:00 2001 From: erikn69 Date: Thu, 24 Aug 2023 07:21:30 -0500 Subject: [PATCH] Fix normalizeFilename when multiple matches (#1430) --- src/DataCollector/QueryCollector.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DataCollector/QueryCollector.php b/src/DataCollector/QueryCollector.php index 8824067c0..2ca8cfcc2 100644 --- a/src/DataCollector/QueryCollector.php +++ b/src/DataCollector/QueryCollector.php @@ -433,7 +433,14 @@ protected function normalizeFilename($path) if (file_exists($path)) { $path = realpath($path); } - return str_replace(base_path(), '', $path); + + $basepath = base_path(); + + if (! str_starts_with($path, $basepath)) { + return $path; + } + + return substr($path, strlen($basepath)); } /**