소스 검색

[Yaml][Parser] throw an exception if not readable

Maksim Kotlyar 13 년 전
부모
커밋
efce640a5e
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      src/Symfony/Component/Yaml/Yaml.php

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

@@ -47,7 +47,14 @@ class Yaml
         $file = '';
 
         // if input is a file, process it
-        if (strpos($input, "\n") === false && is_file($input) && is_readable($input)) {
+        if (strpos($input, "\n") === false && is_file($input)) {
+            if (false === is_readable($input)) {
+                throw new \InvalidArgumentException(sprintf(
+                    'The service file "%s" is not readable.',
+                    $input
+                ));
+            }
+
             $file = $input;
 
             ob_start();