From c02ab0a0baa8e84c145b2440027e6ad417b4686f Mon Sep 17 00:00:00 2001 From: ctrlaltca Date: Fri, 17 Jan 2025 17:36:39 +0100 Subject: [PATCH 1/2] THttpRequest: determine pathInfo from requestUri if previous methods didn't work --- framework/Web/THttpRequest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index 0c9e16446..987069c8a 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -188,6 +188,10 @@ public function init($config) $this->_pathInfo = $_SERVER['PATH_INFO']; } elseif (strpos($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME']) === 0 && $_SERVER['PHP_SELF'] !== $_SERVER['SCRIPT_NAME']) { $this->_pathInfo = substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME'])); + } elseif ($this->_urlFormat === THttpRequestUrlFormat::Path) { + $this->_pathInfo = substr($this->_requestUri, strlen($_SERVER['SCRIPT_NAME'])); + } elseif ($this->_urlFormat === THttpRequestUrlFormat::HiddenPath) { + $this->_pathInfo = substr($this->_requestUri, strlen(dirname($_SERVER['SCRIPT_NAME']))); } else { $this->_pathInfo = ''; } From e32759bae9365e21b801fec8abd528856102efaf Mon Sep 17 00:00:00 2001 From: ctrlaltca Date: Fri, 17 Jan 2025 17:38:18 +0100 Subject: [PATCH 2/2] TUrlManager: urldecode pathInfo before assigning to variables. Fixes usage of "array" parameters like ?ids[]=xxx --- framework/Web/TUrlManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/Web/TUrlManager.php b/framework/Web/TUrlManager.php index 7e04fc0b1..b17eebf20 100644 --- a/framework/Web/TUrlManager.php +++ b/framework/Web/TUrlManager.php @@ -124,7 +124,7 @@ public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpers public function parseUrl() { $request = $this->getRequest(); - $pathInfo = trim($request->getPathInfo(), '/'); + $pathInfo = urldecode(trim($request->getPathInfo(), '/')); if (($request->getUrlFormat() === THttpRequestUrlFormat::Path || $request->getUrlFormat() === THttpRequestUrlFormat::HiddenPath) && $pathInfo !== '') {