Make error messages for disallowed values more explicit

This commit is contained in:
jrenslin authored and stefan committed 2020-10-24 12:46:18 +02:00
1 parent 43bc39d425
commit 2f68acdfc1
1 file changed
+2 -2
+2 -2
View File
@@ -107,7 +107,7 @@ public static function get_http_input_text(string $var_name, string $default = "
else $output = self::sanitize_text($default);
if (!empty($allowed) and !\in_array($output, $allowed, true)) {
Throw new MDpageParameterNotFromListException("Parameter `{$var_name}` must be any of the allowed values: " . implode(', ', $allowed));
Throw new MDpageParameterNotFromListException("Parameter `{$var_name}` must be any of the allowed values: '" . implode('\', \'', $allowed) . "'");
}
return $output;
@@ -132,7 +132,7 @@ public static function get_http_post_text(string $var_name, string $default = ""
else $output = self::sanitize_text($default);
if (!empty($allowed) and !\in_array($output, $allowed, true)) {
Throw new MDpageParameterNotFromListException("Parameter `{$var_name}` must be any of the allowed values: " . implode(', ', $allowed));
Throw new MDpageParameterNotFromListException("Parameter `{$var_name}` must be any of the allowed values: '" . implode('\', \'', $allowed) . "'");
}
return $output;