Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpKernel] Handle nullable callback ofStreamedResponse#51972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
StreamedResponseUh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedOct 12, 2023
Thank you@elementaire. |
| publicfunctiongetCallback():\Closure | ||
| publicfunctiongetCallback():?\Closure | ||
| { | ||
| if (!isset($this->callback)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would usenull === $this->callback for consistency with our other null checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
isset() is what we use on 7.0 because the property is not declared as nullable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
but this whole ticket is about fixing the fact that the callback can be null. So to me, the 7.0 type should also be changed as part of this fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
btw, as the property is protected and not private, this is a BC break to turn it into a non-nullable potentially-uninitialized property as the way to represent an existing state.
…with null (xabbuh)This PR was merged into the 7.0 branch.Discussion----------[HttpFoundation] initialize protected callback property with null| Q | A| ------------- | ---| Branch? | 7.0| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues |Fix#51972 (comment)| License | MITCommits-------b780c12 initialize protected callback property with null
Uh oh!
There was an error while loading.Please reload this page.
This PR fixes a bug introduced by#51396. Having a callback in
StreamResponsedis not a mandatory by design.So the method
getCallbackmust check it likesendContentdoes.When we are dealing with cacheable ressource, only headers are sent from
StreamResponsed, for example:HttpKernelclass have to handle it else if you obtainHTTP 500with messageValue of type null is not callable.cc@nicolas-grekas
EDIT: found by@alexismarquis