-
Notifications
You must be signed in to change notification settings - Fork 150
Headers with value 0 being stripped out. Previous bugfix caused all headers to be accepted. #349
Conversation
This is the if statement that filters out headers that don't begin with
The problem with that is that if
which accounts for the possibility that the value could be "0", which is still a valid value. It actually might be better to say I then changed your test header in from Maybe it is better to say It could break anything that expected |
@bluebaroncanada I think it would be good to add tests for all cases you described in your comment. It could prevent the issue in the future. |
@webimpress Then I have to decide and I hesitate to be the one to decide because I'm not the original author and I don't know his or her intention. |
@weierophinney Should headers with values of More information: http://php.net/manual/en/function.boolval.php |
Well colour me stupid. |
@bluebaroncanada As you are submitting the PR you have to decide how it should form in your opinion. And if you demonstrate it by tests others can see if it makes sense or not. I would change the condition to be |
64188c2
to
0f81d60
Compare
These measures should prevent the critical bug from occurring again. |
|
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.
@bluebaroncanada This is exactly what I've expected. Well done! LGTM 👍
Thanks for the help! |
I have just tested this locally and it fixes the issues mentioned in #350. |
Until this is merged you can use this to skip affected versions: |
This looks good. I'm going to squash the commits so that I can more easily cherry-pick the changes and create a 2.0.3 release; I'll push those back to your branch before merging. |
How do you do that exactly? Would like to know.
On Sat, 5 Jan 2019 at 14:50, weierophinney <notifications@github.com<mailto:notifications@github.com>> wrote:
This looks good. I'm going to squash the commits so that I can more easily cherry-pick the changes and create a 2.0.3 release; I'll push those back to your branch before merging.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#349 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFleUS-O6ZMh9lcmcI6qtcOFWwAWZSKBks5vAQHvgaJpZM4ZeQP9>.
|
A previous change checked for a truthy `$value` in SAPI header sources within the `marshal_headers_from_sapi()` function, which could lead to problems when the value was `0` or `'0'`. This patch adds tests to prevent future changes from causing the issue to re-surface, as well as a fix for the problem.
Forward port #349 Conflicts: CHANGELOG.md
$ git rebase -i HEAD~(number of commits to squash or edit) The |
Provide a narrative description of what you are trying to accomplish:
The header
Upload-Offset
is being stripped. (Any header with value "0")The value was being used in a conditional. To test
!!("0") === false
.Test was incorrect because the header was being stripped because it was not prefixed with
HTTP_
.Relates to 500 error with Apache #347 ServerRequest: Header with value "0" discarded #342 Bugfix: Header with value "0" is being discarded #344
Values with a string of "0" should be accepted
Test passes with proper header formation.
master
branch, and submit against that branch.CHANGELOG.md
entry for the fix.