mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 21:22:17 +00:00
@@ -28,7 +28,7 @@ class InputFile implements IInputItem
|
|||||||
*/
|
*/
|
||||||
public static function createFromArray(array $values)
|
public static function createFromArray(array $values)
|
||||||
{
|
{
|
||||||
if (isset('index', $values) === false) {
|
if (isset($values['index']) === false) {
|
||||||
throw new \InvalidArgumentException('Index key is required');
|
throw new \InvalidArgumentException('Index key is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,15 @@ class Uri
|
|||||||
*/
|
*/
|
||||||
public function parseUrl($url, $component = -1)
|
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) {
|
if ($parts === false) {
|
||||||
throw new \InvalidArgumentException('Malformed URL: ' . $url);
|
throw new \InvalidArgumentException('Malformed URL: ' . $url);
|
||||||
|
|||||||
Reference in New Issue
Block a user