This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier b547855b23 bug #28278 [HttpFoundation] Fix unprepared BinaryFileResponse sends empty file (wackymole)
This PR was merged into the 2.8 branch.

Discussion
----------

[HttpFoundation] Fix unprepared BinaryFileResponse sends empty file

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes, with the exception of preexisting, unrelated failures
| Fixed tickets | #28237
| License       | MIT
| Doc PR        |

When you call `BinaryFileResponse#sendContent()` without first calling `prepare()` the response is sent but the contents are empty. `prepare()` properly initializes the `$maxlen` and `$offset` properties. However, `sendContent()` doesn't do any sanity checking, and so, uses the uninitialized properties. This causes `stream_copy_to_stream()` to copy empty contents and the file that is sent, to contain nothing.

This change initializes the properties at definition instead of in `prepare()`.

> Additionally:
> - Bug fixes must be submitted against the lowest branch where they apply

~I'm not sure how early this bug exists, or how far back to go. I'll check to see if 2.7 and 2.8 are affected and report back.~

Commits
-------

dba8687a5d Instantiate $offset and $maxlen at definition
2018-08-27 17:52:41 +02:00
.composer Drop hirak/prestissimo 2016-05-12 07:44:15 -05:00
.github [travis] fix composer.lock invalidation for deps=low 2018-08-24 14:37:56 +02:00
src/Symfony bug #28278 [HttpFoundation] Fix unprepared BinaryFileResponse sends empty file (wackymole) 2018-08-27 17:52:41 +02:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore Add appveyor.yml for C.I. on Windows 2015-08-25 23:41:37 +02:00
.php_cs.dist Enable native_constant_invocation CS fixer 2018-07-26 13:13:39 +02:00
.travis.yml minor fix for travis 2018-08-19 10:49:05 +02:00
appveyor.yml minor fix for travis 2018-08-19 10:49:05 +02:00
CHANGELOG-2.2.md Merge branch '2.2' into 2.3 2013-12-03 15:51:26 +01:00
CHANGELOG-2.3.md updated CHANGELOG for 2.3.42 2016-05-30 10:40:50 +02:00
CHANGELOG-2.4.md updated CHANGELOG for 2.4.9 2014-09-03 11:50:09 +02:00
CHANGELOG-2.5.md updated CHANGELOG for 2.5.10 2015-02-02 10:26:02 +01:00
CHANGELOG-2.6.md updated CHANGELOG for 2.6.10 2015-07-13 11:34:21 +02:00
CHANGELOG-2.7.md updated CHANGELOG for 2.7.47 2018-05-21 13:47:41 +02:00
CHANGELOG-2.8.md updated CHANGELOG for 2.8.44 2018-08-01 16:12:10 +02:00
composer.json Merge branch '2.7' into 2.8 2018-05-01 15:52:40 -07:00
CONTRIBUTING.md Mention the community review guide 2016-12-18 22:02:35 +01:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.8.44 2018-08-01 16:12:26 +02:00
LICENSE fixed years in copyright 2018-01-03 08:23:28 +01:00
link Update Repository Symlink Helper 2018-02-11 12:15:02 +01:00
phpunit Default testsuite to latest PHPUnit 6.* 2018-05-25 15:04:04 +02:00
phpunit.xml.dist Merge branch '2.7' into 2.8 2017-04-12 07:07:15 -07:00
README.md Add code of Conduct links in our README 2018-05-25 16:34:01 +02:00
UPGRADE-2.1.md Remove aligned '=>' and '=' 2014-10-26 08:30:58 +01:00
UPGRADE-2.2.md Clean up 2018-01-02 16:37:23 +01:00
UPGRADE-2.3.md [Doc] Use Markdown syntax highlighting 2014-10-01 07:38:33 +02:00
UPGRADE-2.4.md Updated UPGRADE-2.4.md 2015-06-08 16:44:57 +02:00
UPGRADE-2.5.md Clean up 2018-01-02 16:37:23 +01:00
UPGRADE-2.6.md Fix grammar 2014-12-30 09:24:50 +01:00
UPGRADE-2.7.md Clean up 2018-01-02 16:37:23 +01:00
UPGRADE-2.8.md fixed CS 2017-08-10 08:50:59 +02:00
UPGRADE-3.0.md Add note about changed form processing when using PUT requests 2018-06-25 13:00:16 +02:00

Symfony is a PHP framework for web applications and a set of reusable PHP components. Symfony is used by thousands of web applications (including BlaBlaCar.com and Spotify.com) and most of the popular PHP projects (including Drupal and Magento).

Installation

Documentation

Community

Contributing

Symfony is an Open Source, community-driven project with thousands of contributors. Join them contributing code or contributing documentation.

Security Issues

If you discover a security vulnerability within Symfony, please follow our disclosure procedure.

About Us

Symfony development is sponsored by SensioLabs, led by the Symfony Core Team and supported by Symfony contributors.