Przeglądaj źródła

[HttpFoundation] fixed PHP 5.4 regression

Fabien Potencier 13 lat temu
rodzic
commit
3043fa0878

+ 4 - 3
src/Symfony/Component/HttpFoundation/File/File.php

@@ -445,15 +445,16 @@ class File extends \SplFileInfo
     /**
      * Constructs a new file from the given path.
      *
-     * @param string $path The path to the file
+     * @param string  $path      The path to the file
+     * @param Boolean $checkPath Whether to check the path or not
      *
      * @throws FileNotFoundException If the given path is not a file
      *
      * @api
      */
-    public function __construct($path)
+    public function __construct($path, $checkPath = true)
     {
-        if (!is_file($path)) {
+        if ($checkPath && !is_file($path)) {
             throw new FileNotFoundException($path);
         }
 

+ 1 - 3
src/Symfony/Component/HttpFoundation/File/UploadedFile.php

@@ -100,9 +100,7 @@ class UploadedFile extends File
         $this->error = $error ?: UPLOAD_ERR_OK;
         $this->test = (Boolean) $test;
 
-        if (UPLOAD_ERR_OK === $this->error) {
-            parent::__construct($path);
-        }
+        parent::__construct($path, UPLOAD_ERR_OK === $this->error);
     }
 
     /**