From 268c9ae85752e5409338df8c94ece1a33424f265 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 20 Aug 2019 00:01:43 -0400 Subject: [PATCH] Handle FastCGI situations where PATH_INFO is not available. Construct it from SCRIPT_NAME and DOCUMENT_URI. --- http/front_controller.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/http/front_controller.php b/http/front_controller.php index d31f1ff..7e7d609 100644 --- a/http/front_controller.php +++ b/http/front_controller.php @@ -94,7 +94,10 @@ class FrontController if (isset($data['PATH_INFO'])) $url = $data['PATH_INFO']; else - $url = '/'; + $url = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['DOCUMENT_URI']); + + $this->request->data['HOPLITE_PATH_INFO'] = $url; + if ($url[0] == '/') $url = substr($url, 1); @@ -209,8 +212,8 @@ class FrontController // Detect the common paths between the REQUEST_URI and the PATH_INFO. That // common piece will be the path to the root controller. $request_uri = $this->request()->data['_SERVER']['REQUEST_URI']; - $path_info = $this->request()->data['_SERVER']['PATH_INFO']; - if ($path_info === NULL) + $path_info = $this->request()->data['HOPLITE_PATH_INFO']; + if (!$path_info) $common_uri = substr($request_uri, 0, -1); else $common_uri = strstr($request_uri, $path_info, TRUE); -- 2.43.5