summaryrefslogtreecommitdiffstats
path: root/lib/private/Mail
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-11 15:15:38 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-11 15:15:38 +0100
commit883848b58a50b03702eab58f67ca577037fcedab (patch)
tree3c1a1c350b5f785db7c444604f95f4fb43fe96b2 /lib/private/Mail
parentd5dea10517bbceaf141f56b6dde0efb55fc6f4b5 (diff)
downloadnextcloud-server-883848b58a50b03702eab58f67ca577037fcedab.tar.gz
nextcloud-server-883848b58a50b03702eab58f67ca577037fcedab.zip
Micro-optimize validation of empty email addresses
Then we don't have to construct any validators. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Mail')
-rw-r--r--lib/private/Mail/Mailer.php4
1 files changed, 4 insertions, 0 deletions
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();