From a2ab9cf83aaead96497a70a1430ce0424c0d8316 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 2 Dec 2021 23:25:07 +0100 Subject: Minz request avoid custom methods (#4020) Take advantage of PHP7+ null-coalescing operator `??` to make code more standard, shorter, and faster instead of custom function with no extra functionality. Allows code to be better tested and fix two PHPstan errors: ``` ------ ----------------------------------------- Line app/Controllers/configureController.php ------ ----------------------------------------- 410 Cannot unset offset 'rid' on string. ------ ----------------------------------------- ------ ------------------------------------ Line lib/Minz/FrontController.php ------ ------------------------------------ 70 Cannot unset offset 'c' on string. 71 Cannot unset offset 'a' on string. ------ ------------------------------------ ``` https://github.com/FreshRSS/FreshRSS/issues/4016 --- lib/Minz/FrontController.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'lib/Minz/FrontController.php') diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php index 33edf37e3..9be39a0d1 100644 --- a/lib/Minz/FrontController.php +++ b/lib/Minz/FrontController.php @@ -38,7 +38,7 @@ class Minz_FrontController { $url = $this->buildUrl(); $url['params'] = array_merge ( $url['params'], - Minz_Request::fetchPOST () + $_POST ); Minz_Request::forward ($url); } catch (Minz_Exception $e) { @@ -56,15 +56,9 @@ class Minz_FrontController { private function buildUrl() { $url = array(); - $url['c'] = Minz_Request::fetchGET( - 'c', - Minz_Request::defaultControllerName() - ); - $url['a'] = Minz_Request::fetchGET( - 'a', - Minz_Request::defaultActionName() - ); - $url['params'] = Minz_Request::fetchGET(); + $url['c'] = $_GET['c'] ?? Minz_Request::defaultControllerName(); + $url['a'] = $_GET['a'] ?? Minz_Request::defaultActionName(); + $url['params'] = $_GET; // post-traitement unset($url['params']['c']); -- cgit v1.2.3