From 7d4a740f8f346f56183adbe6f916e69dc66f7844 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 27 Aug 2020 17:16:48 +0200 Subject: [PATCH] Use strict in_array() calls --- MD_STD.php | 2 +- MD_STD_IN.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MD_STD.php b/MD_STD.php index 5335ec9..5cd1c2a 100644 --- a/MD_STD.php +++ b/MD_STD.php @@ -259,7 +259,7 @@ class MD_STD { while (!empty($lang_code)) { // phpcs:enable // mal sehen, ob der Sprachcode angeboten wird - if (\in_array(\strtolower(\join('-', $lang_code)), $allowed_languages)) { + if (\in_array(\strtolower(\join('-', $lang_code)), $allowed_languages, true)) { // Qualität anschauen if ($lang_quality > $current_q) { // diese Sprache verwenden diff --git a/MD_STD_IN.php b/MD_STD_IN.php index e7412b7..2ff0456 100644 --- a/MD_STD_IN.php +++ b/MD_STD_IN.php @@ -20,7 +20,7 @@ class MD_STD_IN { */ final public static function sanitize_id($input):int { - $input = filter_var($input, FILTER_VALIDATE_INT, [ + $input = \filter_var($input, \FILTER_VALIDATE_INT, [ 'options' => [ 'min_range' => 1, // Minimum number of an ID generated. 'max_range' => 4294967295 // Max value for MySQL's int data type @@ -47,7 +47,7 @@ class MD_STD_IN { if ($input === "") return 0; - $input = filter_var($input, FILTER_VALIDATE_INT, [ + $input = \filter_var($input, \FILTER_VALIDATE_INT, [ 'options' => [ 'min_range' => 0, // Minimum number of an ID generated. 'max_range' => 4294967295 // Max value for MySQL's int data type @@ -103,7 +103,7 @@ class MD_STD_IN { } else $output = self::sanitize_text($default); - if (!empty($allowed) and !in_array($output, $allowed)) { + if (!empty($allowed) and !\in_array($output, $allowed, true)) { Throw new MDpageParameterNotFromListException("Parameter `{$var_name}` must be any of the allowed values: " . implode(', ', $allowed)); } @@ -128,7 +128,7 @@ class MD_STD_IN { } else $output = self::sanitize_text($default); - if (!empty($allowed) and !in_array($output, $allowed)) { + if (!empty($allowed) and !\in_array($output, $allowed, true)) { Throw new MDpageParameterNotFromListException("Parameter `{$var_name}` must be any of the allowed values: " . implode(', ', $allowed)); }