Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better fix for #1894 - "Undefined offset: 0" #1998

Merged
merged 1 commit into from Mar 26, 2018

Conversation

curtisdf
Copy link

@curtisdf curtisdf commented Jan 31, 2018

There's a bug in SetCookie::fromString() which throws an "Undefined offset: 0" error if the inputted $cookie string is missing its first key-value pair, but has at least one other pair. For example, it would be triggered with the following (malformed) cookie:

; foo

Another author submitted a pull request for this (#1894), but the request was rejected due to improper test writing. However, I don't believe the fix itself is appropriate, as I documented there.

So I am submitting my own pull request. The change is trivial. It makes the function return an empty cookie in response to this input, which is the same behavior as this function already has when the first key-value pair is missing the cookie name.

@sagikazarmark sagikazarmark added this to the 6.3.1 milestone Feb 16, 2018
@GrahamCampbell
Copy link
Member

I think #1999 superseeds this, right?

@curtisdf
Copy link
Author

@GrahamCampbell It's two different fixes in the code, and I put them in different branches of my own tree. But I'm confused by how GitHub handles this situation. If the code for both fixes is included in the pull request for #1999 then yeah, I guess it would supersede it. Otherwise both pull requests might need to be accepted separately.

Thanks!

@sagikazarmark
Copy link
Member

Thanks a lot for this fix and apologies for the delay.

As for the PR confusion: looks like you opened this PR from your master branch and the other branch (malformed-domain) obviously originates from it. Although I usually don't like pulling from master, merging this then the other PR should work.

@sagikazarmark sagikazarmark merged commit 8ffb1d2 into guzzle:master Mar 26, 2018
@curtisdf
Copy link
Author

Thanks so much @sagikazarmark. In the future I guess I'll use a custom branch for any PRs rather than the master branch then. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants