1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-28 04:00:43 +02:00

Fix multiple replacement on the same path (#541)

This commit is contained in:
erikn69
2023-08-18 12:40:10 -05:00
committed by GitHub
parent ae41159aa0
commit 48c36d158b

View File

@@ -87,8 +87,15 @@ abstract class DataCollector implements DataCollectorInterface
*/
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]);