Skip to content
Snippets Groups Projects
Unverified Commit 0382a478 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 32e66ac6
No related branches found
No related tags found
No related merge requests found
......@@ -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.
Finish editing this message first!
Please register or to comment