From 2422aae57711fafcedde6b381a0624ca67fa79cb Mon Sep 17 00:00:00 2001 From: wn_ Date: Thu, 18 Nov 2021 18:07:43 +0000 Subject: Consistently handle param string to bool conversions in handlers. --- classes/handler.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'classes/handler.php') diff --git a/classes/handler.php b/classes/handler.php index 3ee42cedb..aca5bf4d2 100644 --- a/classes/handler.php +++ b/classes/handler.php @@ -27,4 +27,10 @@ class Handler implements IHandler { return true; } + /** + * @param mixed $p + */ + protected static function _param_to_bool($p): bool { + return $p && ($p !== "f" && $p !== "false"); + } } -- cgit v1.2.3-54-g00ecf From 16a7208893aa395de2178e1d308b2acec1a50edd Mon Sep 17 00:00:00 2001 From: wn_ Date: Thu, 18 Nov 2021 18:16:50 +0000 Subject: Clean string params in Handler._param_to_bool() --- classes/handler.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'classes/handler.php') diff --git a/classes/handler.php b/classes/handler.php index aca5bf4d2..15f9a1bd8 100644 --- a/classes/handler.php +++ b/classes/handler.php @@ -31,6 +31,9 @@ class Handler implements IHandler { * @param mixed $p */ protected static function _param_to_bool($p): bool { + if (is_string($p)) { + $p = clean($p); + } return $p && ($p !== "f" && $p !== "false"); } } -- cgit v1.2.3-54-g00ecf From cd712926105f18e906132ded25a86dec676ed9cc Mon Sep 17 00:00:00 2001 From: wn_ Date: Thu, 18 Nov 2021 18:18:49 +0000 Subject: Actually, always clean in Handler._param_to_bool() --- classes/handler.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'classes/handler.php') diff --git a/classes/handler.php b/classes/handler.php index 15f9a1bd8..806c9cfbe 100644 --- a/classes/handler.php +++ b/classes/handler.php @@ -31,9 +31,7 @@ class Handler implements IHandler { * @param mixed $p */ protected static function _param_to_bool($p): bool { - if (is_string($p)) { - $p = clean($p); - } + $p = clean($p); return $p && ($p !== "f" && $p !== "false"); } } -- cgit v1.2.3-54-g00ecf