Ver Fonte

[HttpFoundation] use realpath to ensure that there is no .. in file path (to match phpdoc)

Fabien Potencier há 14 anos atrás
pai
commit
854fbd7f68
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      src/Symfony/Component/HttpFoundation/File/File.php

+ 2 - 2
src/Symfony/Component/HttpFoundation/File/File.php

@@ -460,7 +460,7 @@ class File
             throw new FileNotFoundException($path);
         }
 
-        $this->path = $path;
+        $this->path = realpath($path);
     }
 
     /**
@@ -470,7 +470,7 @@ class File
      */
     public function __toString()
     {
-        return null === $this->path ? '' : $this->path;
+        return (string) $this->path;
     }
 
     /**