Closed
Description
What steps will reproduce the problem?
Url::ensureScheme('google.nl/test?param=https://someother.url/', 'https');
What is the expected result?
https://google.nl/test?param=https://someother.url/
What do you get instead?
google.nl/test?param=https://someother.url/
Additional info
This happens because this check is done:
if (($pos = strpos($url, '://')) !== false) {
if ($scheme === '') {
$url = substr($url, $pos + 1);
} else {
$url = $scheme . substr($url, $pos);
}
}
We should use parse_url
to get the correct parts instead of using strpos
.
If parse_url
is not available then we could at least split the string by ?
to ensure we ignore the query part.