Commit 3c72c97d authored by cilefen's avatar cilefen

Issue #2867749 by pfrenssen, claudiu.cristea: Parsing an URL with another URL...

Issue #2867749 by pfrenssen, claudiu.cristea: Parsing an URL with another URL in the query arguments throws undefined offset notice
parent d2a5fe79
...@@ -142,7 +142,12 @@ public static function parse($url) { ...@@ -142,7 +142,12 @@ public static function parse($url) {
// External URLs: not using parse_url() here, so we do not have to rebuild // External URLs: not using parse_url() here, so we do not have to rebuild
// the scheme, host, and path without having any use for it. // the scheme, host, and path without having any use for it.
if (strpos($url, '://') !== FALSE) { // The URL is considered external if it contains the '://' delimiter. Since
// a URL can also be passed as a query argument, we check if this delimiter
// appears in front of the '?' query argument delimiter.
$scheme_delimiter_position = strpos($url, '://');
$query_delimiter_position = strpos($url, '?');
if ($scheme_delimiter_position !== FALSE && ($query_delimiter_position === FALSE || $scheme_delimiter_position < $query_delimiter_position)) {
// Split off everything before the query string into 'path'. // Split off everything before the query string into 'path'.
$parts = explode('?', $url); $parts = explode('?', $url);
......
...@@ -736,6 +736,7 @@ public function providerFromValidInternalUri() { ...@@ -736,6 +736,7 @@ public function providerFromValidInternalUri() {
['/?page=1000'], ['/?page=1000'],
['?page=1000'], ['?page=1000'],
['?breed=bengal&page=1000'], ['?breed=bengal&page=1000'],
['?referrer=https://kittenfacts'],
// Paths with various token formats but no leading slash. // Paths with various token formats but no leading slash.
['/[duckies]'], ['/[duckies]'],
['/%bunnies'], ['/%bunnies'],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment