Skip to content

Commit

Permalink
[TwigBridge] fixed format_file to include the line number even if the…
Browse files Browse the repository at this point in the history
… link text is passed

That fixes the logs in the profiler where lines were not displayed for
deprecated calls.
  • Loading branch information
fabpot committed Jan 20, 2013
1 parent 6923a48 commit 32322a1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Symfony/Bridge/Twig/Extension/CodeExtension.php
Expand Up @@ -164,15 +164,15 @@ public function formatFile($file, $line, $text = null)
{
if (null === $text) {
$file = trim($file);
$fileStr = $file;
if (0 === strpos($fileStr, $this->rootDir)) {
$fileStr = str_replace($this->rootDir, '', str_replace('\\', '/', $fileStr));
$fileStr = sprintf('<abbr title="%s">kernel.root_dir</abbr>/%s', $this->rootDir, $fileStr);
$text = $file;
if (0 === strpos($text, $this->rootDir)) {
$text = str_replace($this->rootDir, '', str_replace('\\', '/', $text));
$text = sprintf('<abbr title="%s">kernel.root_dir</abbr>/%s', $this->rootDir, $text);
}

$text = "$fileStr at line $line";
}

$text = "$text at line $line";

if (false !== $link = $this->getFileLink($file, $line)) {
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), $text);
}
Expand Down

0 comments on commit 32322a1

Please sign in to comment.