From c37a313924e4a3051b478ffd224cbaece7873d6f Mon Sep 17 00:00:00 2001 From: William Date: Thu, 29 Dec 2022 03:39:50 +0000 Subject: [PATCH] I'm stupid --- app/WillySoft/Http/Route.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/WillySoft/Http/Route.php b/app/WillySoft/Http/Route.php index 48ae9fa..4e3c527 100644 --- a/app/WillySoft/Http/Route.php +++ b/app/WillySoft/Http/Route.php @@ -17,13 +17,13 @@ abstract class Route )) return; // check if the route matches and add parameters if any - // TODO: this is just really messy man wtf - if (!isset($_SERVER['PATH_INFO'])) { - $_SERVER['PATH_INFO'] = '/'; + $request_path = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['PHP_SELF']); + if ($request_path === '') { + $request_path = '/'; } $args = []; $path_parts = explode('/', $path); - $request_path_parts = explode('/', $_SERVER['PATH_INFO']); + $request_path_parts = explode('/', $request_path); for ($i=0; $i < count($path_parts); $i++) { if (empty($path_parts[$i])) { continue;