mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-16 18:50:11 +03:00
Fixed url parsing issues
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user