Fixed url parsing issues

This commit is contained in:
Simon Sessingø
2017-11-26 18:45:06 +01:00
parent fae2e84c98
commit af2be14ccb

View File

@@ -134,7 +134,15 @@ class Uri
*/
public function parseUrl($url, $component = -1)
{
$parts = parse_url(urlencode($url), $component);
$encodedUrl = preg_replace_callback(
'%[^:/@?&=#]+%u',
function ($matches) {
return urlencode($matches[0]);
},
$url
);
$parts = parse_url($encodedUrl, $component);
if ($parts === false) {
throw new \InvalidArgumentException('Malformed URL: ' . $url);