diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php index d43e0732cd..55c2ac5dd6 100644 --- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -81,7 +81,9 @@ class BinaryFileResponse extends Response */ public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) { - $file = new File((string) $file); + if (!$file instanceof File) { + $file = new File((string) $file); + } if (!$file->isReadable()) { throw new FileException('File must be readable.');