瀏覽代碼

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

Fabien Potencier 14 年之前
父節點
當前提交
854fbd7f68
共有 1 個文件被更改,包括 2 次插入2 次删除
  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;
     }
 
     /**