Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c5c6f08

Browse filesBrowse files
committed
fix PHP 7 compatibility
1 parent 9e22055 commit c5c6f08
Copy full SHA for c5c6f08

File tree

1 file changed

+9
-2
lines changed
Filter options

1 file changed

+9
-2
lines changed

‎src/Symfony/Component/Mime/Message.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Message.php
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,18 @@ public function toIterable(): iterable
124124

125125
public function ensureValidity()
126126
{
127-
if (!$this->headers->get('To')?->getBody() && !$this->headers->get('Cc')?->getBody() && !$this->headers->get('Bcc')?->getBody()) {
127+
$to = (null !== $header = $this->headers->get('To')) ? $header->getBody() : null;
128+
$cc = (null !== $header = $this->headers->get('Cc')) ? $header->getBody() : null;
129+
$bcc = (null !== $header = $this->headers->get('Bcc')) ? $header->getBody() : null;
130+
131+
if (!$to && !$cc && !$bcc) {
128132
throw new LogicException('An email must have a "To", "Cc", or "Bcc" header.');
129133
}
130134

131-
if (!$this->headers->get('From')?->getBody() && !$this->headers->get('Sender')?->getBody()) {
135+
$from = (null !== $header = $this->headers->get('From')) ? $header->getBody() : null;
136+
$sender = (null !== $header = $this->headers->get('Sender')) ? $header->getBody() : null;
137+
138+
if (!$from && !$sender) {
132139
throw new LogicException('An email must have a "From" or a "Sender" header.');
133140
}
134141

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.