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/rpc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes/rpc.php') diff --git a/classes/rpc.php b/classes/rpc.php index 75d008b8b..584b86b23 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -173,7 +173,7 @@ class RPC extends Handler_Protected { } function sanityCheck(): void { - $_SESSION["hasSandbox"] = clean($_REQUEST["hasSandbox"]) === "true"; + $_SESSION["hasSandbox"] = self::_param_to_bool($_REQUEST["hasSandbox"] ?? null); $_SESSION["clientTzOffset"] = clean($_REQUEST["clientTzOffset"]); $client_location = $_REQUEST["clientLocation"]; @@ -225,7 +225,7 @@ class RPC extends Handler_Protected { function catchupFeed(): void { $feed_id = clean($_REQUEST['feed_id']); - $is_cat = clean($_REQUEST['is_cat']) == "true"; + $is_cat = self::_param_to_bool($_REQUEST['is_cat'] ?? null); $mode = clean($_REQUEST['mode'] ?? ''); $search_query = clean($_REQUEST['search_query']); $search_lang = clean($_REQUEST['search_lang']); -- cgit v1.2.3 From d532eb773bc460fe01a10e980fecbb1fdc53497c Mon Sep 17 00:00:00 2001 From: wn_ Date: Thu, 18 Nov 2021 18:23:44 +0000 Subject: Switch from null to false as the default for missing bool params. --- classes/rpc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes/rpc.php') diff --git a/classes/rpc.php b/classes/rpc.php index 584b86b23..4f6a2fe1d 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -173,7 +173,7 @@ class RPC extends Handler_Protected { } function sanityCheck(): void { - $_SESSION["hasSandbox"] = self::_param_to_bool($_REQUEST["hasSandbox"] ?? null); + $_SESSION["hasSandbox"] = self::_param_to_bool($_REQUEST["hasSandbox"] ?? false); $_SESSION["clientTzOffset"] = clean($_REQUEST["clientTzOffset"]); $client_location = $_REQUEST["clientLocation"]; @@ -225,7 +225,7 @@ class RPC extends Handler_Protected { function catchupFeed(): void { $feed_id = clean($_REQUEST['feed_id']); - $is_cat = self::_param_to_bool($_REQUEST['is_cat'] ?? null); + $is_cat = self::_param_to_bool($_REQUEST['is_cat'] ?? false); $mode = clean($_REQUEST['mode'] ?? ''); $search_query = clean($_REQUEST['search_query']); $search_lang = clean($_REQUEST['search_lang']); -- cgit v1.2.3