Skip to content
Snippets Groups Projects
Unverified Commit cf1f9671 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3091823 by Renrhaf, johndevman: UrlHelper::parse does not support...

Issue #3091823 by Renrhaf, johndevman: UrlHelper::parse does not support external URLs with more than one question mark

(cherry picked from commit 52320cc8)
parent b8b80348
No related branches found
No related tags found
9 merge requests!1445Issue #2920039: Views' User Name exposed group filter validation,!1298Issue #3240993: Let layout builder render inline block translations,!774Issue #3174569: Example node template file name is incorrect,!497Issue #2463967: Use .user.ini file for PHP settings,!433Resolve #3163663 "Too many open files",!233Resolve #2693787 "Taxonomy term name",!133Resolve #2666286 "Clean up menuui",!112Resolve #3187004 "Drupaldatetime serialization issue",!53Resolve #3181870: Correct typo "the the" in "core/classList" deprecation message.
......@@ -154,7 +154,7 @@ public static function parse($url) {
}
// Split off everything before the query string into 'path'.
$parts = explode('?', $url);
$parts = explode('?', $url, 2);
// Don't support URLs without a path, like 'http://'.
list(, $path) = explode('://', $parts[0], 2);
......
......@@ -311,6 +311,42 @@ public static function providerTestParse() {
'fragment' => 'footer',
],
],
'URL with two question marks, not encoded' => [
'http://www.example.com/my/path?destination=home&search=http://www.example.com/search?limit=10#footer',
[
'path' => 'http://www.example.com/my/path',
'query' => [
'destination' => 'home',
'search' => 'http://www.example.com/search?limit=10',
],
'fragment' => 'footer',
],
],
'URL with three question marks, not encoded' => [
'http://www.example.com/my/path?destination=home&search=http://www.example.com/search?limit=10&referer=http://www.example.com/my/path?destination=home&other#footer',
[
'path' => 'http://www.example.com/my/path',
'query' => [
'destination' => 'home',
'search' => 'http://www.example.com/search?limit=10',
'referer' => 'http://www.example.com/my/path?destination=home',
'other' => '',
],
'fragment' => 'footer',
],
],
'URL with three question marks, encoded' => [
'http://www.example.com/my/path?destination=home&search=http://www.example.com/search?limit=10&referer=http%3A%2F%2Fwww.example.com%2Fmy%2Fpath%3Fdestination%3Dhome%26other#footer',
[
'path' => 'http://www.example.com/my/path',
'query' => [
'destination' => 'home',
'search' => 'http://www.example.com/search?limit=10',
'referer' => 'http://www.example.com/my/path?destination=home&other',
],
'fragment' => 'footer',
],
],
];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment