From: Robert Sesek Date: Tue, 20 Aug 2019 04:01:43 +0000 (-0400) Subject: Handle FastCGI situations where PATH_INFO is not available. X-Git-Url: https://src.bluestatic.org/?a=commitdiff_plain;p=hoplite.git Handle FastCGI situations where PATH_INFO is not available. Construct it from SCRIPT_NAME and DOCUMENT_URI. --- 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);