Преглед на файлове

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