From 40f45b57949402ed78ebe451600594faad1e662e Mon Sep 17 00:00:00 2001 From: Merci Jacob Date: Thu, 2 May 2024 16:35:30 +0200 Subject: [PATCH] adapt filter_input_array Hm_Function to return expected _SERVER data in FastCGI as well --- lib/framework.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/framework.php b/lib/framework.php index 8623a8b2f2..5d56a4c8f5 100644 --- a/lib/framework.php +++ b/lib/framework.php @@ -201,6 +201,17 @@ public static function redis() { * @return array filtered list */ public static function filter_input_array($type, $filters) { + /* + In FastCGI, filter_input_array does not work as intended with INPUT_SERVER because its stored copy of data doesn't get modified during the request. + So we need to explicitly access the $_SERVER. + */ + if ($type === INPUT_SERVER) { + $value = array(); + foreach ($filters as $var => $flag) { + $value[$var] = filter_var($_SERVER[$var], $flag); + } + return $value; + } return filter_input_array($type, $filters, false); }