[2.8] Encode plus sign in withQueryValue() and withQueryValues()#636
[2.8] Encode plus sign in withQueryValue() and withQueryValues()#636eyupcanakman wants to merge 2 commits intoguzzle:2.8from
Conversation
|
Thank you @eyupcanakman for your fix proposal and for making sure all the tests correctly pass; after so much time things are moving forward. My twopence contribution: I've been using a custom modified version of Guzzle - with your very proposed fix - in a production environment since I first opened the issue in Nov 15, 2024. There is only one additional descriptive text you may want to put in your PR: in the I think it's maintainability-safe to just add in the |
|
@edegaudenzi Thanks for testing it out. Good catch on the docblock. I'll add the |
Uri::withQueryValue()andUri::withQueryValues()do not percent-encode+in keys or values. Most HTTP servers interpret an unencoded
+in a querystring as a space (per the
application/x-www-form-urlencodedconvention),which corrupts values that contain literal plus signs.
+is a sub-delimiter under RFC 3986, sofilterQueryAndFragment()lets itthrough. But
Query::build()already encodes+to%2Bviarawurlencode().The fix adds
'+' => '%2B'toQUERY_SEPARATORS_REPLACEMENTso both codepaths produce the same output.
Added a test covering
+in keys, values, and alongside spaces.Fixes #618.