瀏覽代碼

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

Fabien Potencier 14 年之前
父節點
當前提交
d873f21f69
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

+ 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)