Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpFoundation] fixed Request::getContent() reusage bug#19549
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
Closed
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
After calling Request::getContent(true), subsequent calls to thesame instance method (withouth the $asResource flag) always returnedfalse instead of the request body as a plain string.A unit test already existed to guard against this behaviour but ityielded a false positive because it was comparing '' to false usingPHPUnit's assertEquals() instead of assertSame().For completeness sake I also added the missing usage permutations inthe test data provider.
…pending on the PHP version (<5.6) and the usage pattern
Member
fabpot commentedAug 15, 2016
Thank you@1ma. |
fabpot added a commit that referenced this pull requestAug 15, 2016
…1ma)This PR was squashed before being merged into the 2.7 branch (closes#19549).Discussion----------[HttpFoundation] fixed Request::getContent() reusage bug| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets || License | MIT| Doc PR |After calling ```Request::getContent(true)```, subsequent calls to thesame instance method (withouth the ```$asResource``` flag) always returned```false``` instead of the request body as a plain string.A unit test already existed to guard against this behaviour (the 'Resource then fetch' case) but ityielded a false positive because it was comparing ```''``` to ```false``` usingPHPUnit's ```assertEquals``` method instead of ```assertSame```.For completeness sake I also added the missing usage permutations inthe data provider, which already worked OK.Commits-------c42ac66 [HttpFoundation] fixed Request::getContent() reusage bug
This was referencedSep 2, 2016
Merged
Merged
Merged
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After calling
Request::getContent(true), subsequent calls to thesame instance method (withouth the
$asResourceflag) always returnedfalseinstead of the request body as a plain string.A unit test already existed to guard against this behaviour (the 'Resource then fetch' case) but it
yielded a false positive because it was comparing
''tofalseusingPHPUnit's
assertEqualsmethod instead ofassertSame.For completeness sake I also added the missing usage permutations in
the data provider, which already worked OK.