소스 검색

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