From: Tim Düsterhus Date: Sun, 1 Jan 2017 18:45:05 +0000 (+0100) Subject: Stop silently overwriting recipients in Email::addRecipient() X-Git-Tag: 3.0.0~78 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=29daa3ebb3bcb12fbd5c4eb42c62a5d6cc010fc1;p=GitHub%2FWoltLab%2FWCF.git Stop silently overwriting recipients in Email::addRecipient() --- diff --git a/wcfsetup/install/files/lib/system/email/Email.class.php b/wcfsetup/install/files/lib/system/email/Email.class.php index 4596cb7ec1..230c7bc613 100644 --- a/wcfsetup/install/files/lib/system/email/Email.class.php +++ b/wcfsetup/install/files/lib/system/email/Email.class.php @@ -308,6 +308,10 @@ class Email { throw new \DomainException("The given type '".$type."' is invalid. Must be one of 'to', 'cc', 'bcc'."); } + if (isset($this->recipients[$recipient->getAddress()])) { + throw new \UnexpectedValueException("There already is a recipient with the email address '".$recipient->getAddress()."'. If you want to change the \$type use removeRecipient() first."); + } + $this->recipients[$recipient->getAddress()] = [ 'type' => $type, 'mailbox' => $recipient