Use strict in_array() calls

This commit is contained in:
2020-08-27 17:16:48 +02:00
committed by Stefan Rohde-Enslin
parent b39f26a3f7
commit 7d4a740f8f
2 changed files with 5 additions and 5 deletions

View File

@ -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));
}