From fc04ad21342bf360c62ef8bff024e654360eb48b Mon Sep 17 00:00:00 2001 From: Andreas Lutro Date: Mon, 28 Apr 2014 14:17:03 +0200 Subject: [PATCH] Allow File instance to be passed to BinaryFileResponse --- src/Symfony/Component/HttpFoundation/BinaryFileResponse.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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.');