Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cb26c19

Browse filesBrowse files
Daniel Kozáknicolas-grekas
Daniel Kozák
authored andcommitted
[HttpClient] Fix encoding some characters in query strings
1 parent 124311a commit cb26c19
Copy full SHA for cb26c19

File tree

2 files changed

+3
-6
lines changed
Filter options

2 files changed

+3
-6
lines changed

‎src/Symfony/Component/HttpClient/HttpClientTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/HttpClientTrait.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ private static function parseUrl(string $url, array $query = [], array $allowedS
547547
}
548548

549549
// https://tools.ietf.org/html/rfc3986#section-3.3
550-
$parts[$part] = preg_replace_callback("#[^-A-Za-z0-9._~!$&/'()[\]*+,;=:@\\\\^`{|}%]++#", function ($m) { return rawurlencode($m[0]); }, $parts[$part]);
550+
$parts[$part] = preg_replace_callback("#[^-A-Za-z0-9._~!$&/'()[\]*+,;=:@{}%]++#", function ($m) { return rawurlencode($m[0]); }, $parts[$part]);
551551
}
552552

553553
return [
@@ -634,11 +634,7 @@ private static function mergeQueryString(?string $queryString, array $queryArray
634634
'%3B' => ';',
635635
'%40' => '@',
636636
'%5B' => '[',
637-
'%5C' => '\\',
638637
'%5D' => ']',
639-
'%5E' => '^',
640-
'%60' => '`',
641-
'%7C' => '|',
642638
]);
643639
}
644640

‎src/Symfony/Component/HttpClient/Tests/HttpClientTraitTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/Tests/HttpClientTraitTest.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,13 @@ public static function provideParseUrl(): iterable
155155
yield [['http:', '//example.com', null, null, null], 'http://Example.coM:80'];
156156
yield [['https:', '//xn--dj-kia8a.example.com:8000', '/', null, null], 'https://DÉjà.Example.com:8000/'];
157157
yield [[null, null, '/f%20o.o', '?a=b', '#c'], '/f o%2Eo?a=b#c'];
158+
yield [[null, null, '/custom%7C2010-01-01%2000:00:00%7C2023-06-15%2005:50:35', '?a=b', '#c'], '/custom|2010-01-01 00:00:00|2023-06-15 05:50:35?a=b#c'];
158159
yield [[null, '//a:b@foo', '/bar', null, null], '//a:b@foo/bar'];
159160
yield [[null, '//a:b@foo', '/b{}', null, null], '//a:b@foo/b{}'];
160161
yield [['http:', null, null, null, null], 'http:'];
161162
yield [['http:', null, 'bar', null, null], 'http:bar'];
162163
yield [[null, null, 'bar', '?a=1&c=c', null], 'bar?a=a&b=b', ['b' => null, 'c' => 'c', 'a' => 1]];
163-
yield [[null, null, 'bar', '?a=b+c&b=b-._~!$%26/%27()[]*%2B%2C;%3D:@%25\\^`%7B|%7D', null], 'bar?a=b+c', ['b' => 'b-._~!$&/\'()[]*+,;=:@%\\^`{|}']];
164+
yield [[null, null, 'bar', '?a=b+c&b=b-._~!$%26/%27()[]*%2B%2C;%3D:@%25%5C%5E%60%7B%7C%7D', null], 'bar?a=b+c', ['b' => 'b-._~!$&/\'()[]*+,;=:@%\\^`{|}']];
164165
yield [[null, null, 'bar', '?a=b%2B%20c', null], 'bar?a=b+c', ['a' => 'b+ c']];
165166
yield [[null, null, 'bar', '?a[b]=c', null], 'bar', ['a' => ['b' => 'c']]];
166167
yield [[null, null, 'bar', '?a[b[c]=d', null], 'bar?a[b[c]=d', []];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.