8000 Instantiate $offset and $maxlen at definition · symfony/symfony@dba8687 · GitHub
[go: up one dir, main page]

Skip to content

Commit dba8687

Browse files
committed
Instantiate $offset and $maxlen at definition
1 parent 0332f86 commit dba8687

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class BinaryFileResponse extends Response
3131
* @var File
3232
*/
3333
protected $file;
34-
protected $offset;
35-
protected $maxlen;
34+
protected $offset = 0;
35+
protected $maxlen = -1;
3636
protected $deleteFileAfterSend = false;
3737

3838
/**

src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,19 @@ public function provideFullFileRanges()
206206
);
207207
}
208208

209+
public function testUnpreparedResponseSendsFullFile()
210+
{
211+
$response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200);
212+
213+
$data = file_get_contents(__DIR__.'/File/Fixtures/test.gif');
214+
215+
$this->expectOutputString($data);
216+
$response = clone $response;
217+
$response->sendContent();
218+
219+
$this->assertEquals(200, $response->getStatusCode());
220+
}
221+
209222
/**
210223
* @dataProvider provideInvalidRanges
211224
*/

0 commit comments

Comments
 (0)
0