From 883848b58a50b03702eab58f67ca577037fcedab Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 11 Feb 2021 15:15:38 +0100 Subject: Micro-optimize validation of empty email addresses Then we don't have to construct any validators. Signed-off-by: Christoph Wurst --- lib/private/Mail/Mailer.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index f8dc739428a..2e996dea502 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -221,6 +221,10 @@ class Mailer implements IMailer { * @return bool True if the mail address is valid, false otherwise */ public function validateMailAddress(string $email): bool { + if ($email === '') { + // Shortcut: empty addresses are never valid + return false; + } $validator = new EmailValidator(); $validation = new RFCValidation(); -- cgit v1.2.3