Skip to content

Commit

Permalink
Fix multiple replacement on the same path (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Aug 18, 2023
1 parent ae41159 commit 48c36d1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/DebugBar/DataCollector/DataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,15 @@ public function getDataFormatter()
*/
public function getXdebugLink($file, $line = 1)
{
if (count($this->xdebugReplacements)) {
$file = strtr($file, $this->xdebugReplacements);
if (file_exists($file)) {
$file = realpath($file);
}

foreach ($this->xdebugReplacements as $path => $replacement) {
if (strpos($file, $path) === 0) {
$file = $replacement . substr($file, strlen($path));
break;
}
}

$url = strtr($this->getXdebugLinkTemplate(), ['%f' => $file, '%l' => $line]);
Expand Down

0 comments on commit 48c36d1

Please sign in to comment.