瀏覽代碼

Check if config/template file is actually readable before further processing

Lenar Lõhmus 14 年之前
父節點
當前提交
c6bbecf0bb
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      src/Symfony/Component/Templating/Loader/FilesystemLoader.php
  2. 1 1
      src/Symfony/Component/Yaml/Yaml.php

+ 1 - 1
src/Symfony/Component/Templating/Loader/FilesystemLoader.php

@@ -60,7 +60,7 @@ class FilesystemLoader extends Loader
 
 
         $logs = array();
         $logs = array();
         foreach ($this->templatePathPatterns as $templatePathPattern) {
         foreach ($this->templatePathPatterns as $templatePathPattern) {
-            if (is_file($file = strtr($templatePathPattern, $replacements))) {
+            if (is_file($file = strtr($templatePathPattern, $replacements)) && is_readable($file)) {
                 if (null !== $this->debugger) {
                 if (null !== $this->debugger) {
                     $this->debugger->log(sprintf('Loaded template file "%s"', $file));
                     $this->debugger->log(sprintf('Loaded template file "%s"', $file));
                 }
                 }

+ 1 - 1
src/Symfony/Component/Yaml/Yaml.php

@@ -69,7 +69,7 @@ class Yaml
         $file = '';
         $file = '';
 
 
         // if input is a file, process it
         // if input is a file, process it
-        if (strpos($input, "\n") === false && is_file($input)) {
+        if (strpos($input, "\n") === false && is_file($input) && is_readable($input)) {
             $file = $input;
             $file = $input;
 
 
             ob_start();
             ob_start();