Improve sanitizers for mails, urls

This commit is contained in:
Joshua Ramon Enslin 2020-09-04 01:37:49 +02:00 committed by Stefan Rohde-Enslin
parent f478728ab9
commit b16a6762e4

View File

@ -148,7 +148,7 @@ final class MD_STD_IN {
if ($input === "") return "";
$output = \filter_var($input, FILTER_SANITIZE_URL);
if (\filter_var($output, FILTER_VALIDATE_URL) === false) {
if (($output = \filter_var($output, FILTER_VALIDATE_URL)) === false) {
throw new MDInvalidUrl("Invalid input URL");
}
@ -168,7 +168,7 @@ final class MD_STD_IN {
if ($input === "") return "";
$output = \filter_var($input, FILTER_SANITIZE_EMAIL);
if (\filter_var($output, FILTER_VALIDATE_EMAIL) === false) {
if (($output = \filter_var($output, FILTER_VALIDATE_EMAIL)) === false) {
throw new MDInvalidEmail("Invalid input email address");
}