Make error messages for disallowed values more explicit

This commit is contained in:
Joshua Ramon Enslin 2020-10-24 12:46:18 +02:00 committed by Stefan Rohde-Enslin
parent 43bc39d425
commit 2f68acdfc1
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -107,7 +107,7 @@ final class MD_STD_IN {
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 @@ final class MD_STD_IN {
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;