diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index 763f315f8ab5c..93d99f936c740 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -36,7 +36,7 @@ class CodeExtension extends \Twig_Extension public function __construct($fileLinkFormat, $rootDir, $charset) { $this->fileLinkFormat = empty($fileLinkFormat) ? ini_get('xdebug.file_link_format') : $fileLinkFormat; - $this->rootDir = str_replace('\\', '/', $rootDir).'/'; + $this->rootDir = str_replace('\\', '/', dirname($rootDir)).'/'; $this->charset = $charset; } @@ -164,12 +164,14 @@ public function fileExcerpt($file, $line) */ public function formatFile($file, $line, $text = null) { + $file = trim($file); + if (null === $text) { - $file = trim($file); - $text = $file; + $text = str_replace('\\', '/', $file); if (0 === strpos($text, $this->rootDir)) { - $text = str_replace($this->rootDir, '', str_replace('\\', '/', $text)); - $text = sprintf('kernel.root_dir/%s', $this->rootDir, $text); + $text = substr($text, strlen($this->rootDir)); + $text = explode('/', $text, 2); + $text = sprintf('%s%s', $this->rootDir, $text[0], isset($text[1]) ? '/'.$text[1] : ''); } } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/admin.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/admin.html.twig index 3ca28ff1629c0..54140171726dc 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/admin.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/admin.html.twig @@ -13,8 +13,8 @@ » Export {% endif %} - » 
-
+ » 
+