From: Tim Düsterhus Date: Sat, 11 Jun 2016 20:07:34 +0000 (+0200) Subject: Throw proper exception on empty email body X-Git-Tag: 3.0.0_Beta_1~1458 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1a3abe0ea02c176fff76784781a3977c3ae9e464;p=GitHub%2FWoltLab%2FWCF.git Throw proper exception on empty email body --- diff --git a/wcfsetup/install/files/lib/system/email/Email.class.php b/wcfsetup/install/files/lib/system/email/Email.class.php index 15af4756aa..4764f3a0cd 100644 --- a/wcfsetup/install/files/lib/system/email/Email.class.php +++ b/wcfsetup/install/files/lib/system/email/Email.class.php @@ -446,6 +446,10 @@ class Email { * @return string */ public function getBodyString() { + if ($this->body === null) { + throw new \LogicException('Cannot generate message body, you must specify a body'); + } + switch ($this->body->getContentTransferEncoding()) { case 'quoted-printable': return quoted_printable_encode($this->body->getContent()); @@ -471,6 +475,9 @@ class Email { // ensure every header is filled in $this->getHeaders(); + // ensure the body is filled in + $this->getBodyString(); + foreach ($this->recipients as $recipient) { $mail = clone $this;