From 2ab152e158bf7f48076de3e61e359dc807f92b68 Mon Sep 17 00:00:00 2001 From: Knah-Tsaeb Date: Tue, 3 Dec 2024 16:57:27 +0100 Subject: [PATCH] Test empty var --- app/Router.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Router.php b/app/Router.php index 94d3964..176ff35 100644 --- a/app/Router.php +++ b/app/Router.php @@ -32,10 +32,13 @@ class Router { * @return array|false Returns an array containing the target and parameters */ public function match(array $config): array|false { + $extraParams = []; $requestMethod = $_SERVER['REQUEST_METHOD']; $this->requestUrl = $requestUrl = strtok($_SERVER['REQUEST_URI'], '?'); - parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $extraParams); + if (!empty(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY))) { + parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $extraParams); + } foreach ($this->routes as $route) { list($method, $url, $target) = $route;