Sfoglia il codice sorgente

[FrameworkBundle] removed links in exceptions when the file does not exist (mostly useful because of shortcut notations for templates)

Fabien Potencier 14 anni fa
parent
commit
d873f21f69

+ 5 - 1
src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

@@ -189,7 +189,11 @@ class CodeHelper extends Helper
      */
     public function getFileLink($file, $line)
     {
-        return $this->fileLinkFormat ? strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line)) : false;
+        if ($this->fileLinkFormat && file_exists($file)) {
+            return strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line));
+        }
+
+        return false;
     }
 
     public function formatFileFromText($text)