Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #28278 [HttpFoundation] Fix unprepared BinaryFileResponse sends e…
…mpty 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 ------- dba8687 Instantiate $offset and $maxlen at definition
- Loading branch information