Skip to content

Commit 3ac294a

Browse files
authored
Merge pull request #405 from barbushin/develop
Added PHP 7.4 support and additional checks
2 parents 87fba0f + 7b6a42a commit 3ac294a

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ php:
99
- 7.1
1010
- 7.2
1111
- 7.3
12-
# - 7.4 # Not supported yet (2019-11-12)
13-
# - 8.0 # Not supported yet (2019-11-12)
12+
- 7.4snapshot
1413

1514
before_script:
1615
- composer install --no-interaction

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Initially released in December 2012, the PHP IMAP Mailbox is a powerful and open
2121

2222
### Requirements
2323

24-
* PHP 5.6, 7.0, 7.1, 7.2 or 7.3
24+
* PHP 5.6, 7.0, 7.1, 7.2, 7.3 or 7.4
2525
* PHP `imap` extension must be present; so make sure this line is active in your php.ini: `extension=php_imap.dll`
2626
* PHP `mbstring` extension must be present; so make sure this line is active in your php.ini: `extension=php_mbstring.dll`
2727
* PHP `iconv` extension must be present, if `mbstring` is not available; so make sure this line is active in your php.ini: `extension=php_iconv.dll`

src/PhpImap/Mailbox.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ public function getMailHeader($mailId)
923923
if (isset($head->to)) {
924924
$toStrings = [];
925925
foreach ($head->to as $to) {
926-
if (!empty($to->mailbox) && !empty(trim($to->host))) {
926+
if (isset($to->mailbox) && !empty(trim($to->mailbox)) && isset($to->host) && !empty(trim($to->host))) {
927927
$toEmail = strtolower($to->mailbox.'@'.$to->host);
928928
$toName = (isset($to->personal) and !empty(trim($to->personal))) ? $this->decodeMimeStr($to->personal, $this->getServerEncoding()) : null;
929929
$toStrings[] = $toName ? "$toName <$toEmail>" : $toEmail;
@@ -935,7 +935,7 @@ public function getMailHeader($mailId)
935935

936936
if (isset($head->cc)) {
937937
foreach ($head->cc as $cc) {
938-
if (!empty(trim($cc->mailbox)) && !empty(trim($cc->host))) {
938+
if (isset($cc->mailbox) && !empty(trim($cc->mailbox)) && isset($cc->host) && !empty(trim($cc->host))) {
939939
$ccEmail = strtolower($cc->mailbox.'@'.$cc->host);
940940
$ccName = (isset($cc->personal) and !empty(trim($cc->personal))) ? $this->decodeMimeStr($cc->personal, $this->getServerEncoding()) : null;
941941
$ccStrings[] = $ccName ? "$ccName <$ccEmail>" : $ccEmail;
@@ -946,7 +946,7 @@ public function getMailHeader($mailId)
946946

947947
if (isset($head->bcc)) {
948948
foreach ($head->bcc as $bcc) {
949-
if (!empty(trim($bcc->mailbox)) && !empty(trim($bcc->host))) {
949+
if (isset($bcc->mailbox) && !empty(trim($bcc->mailbox)) && isset($bcc->host) && !empty(trim($bcc->host))) {
950950
$bccEmail = strtolower($bcc->mailbox.'@'.$bcc->host);
951951
$bccName = (isset($bcc->personal) and !empty(trim($bcc->personal))) ? $this->decodeMimeStr($bcc->personal, $this->getServerEncoding()) : null;
952952
$bccStrings[] = $bccName ? "$bccName <$bccEmail>" : $bccEmail;
@@ -957,7 +957,7 @@ public function getMailHeader($mailId)
957957

958958
if (isset($head->reply_to)) {
959959
foreach ($head->reply_to as $replyTo) {
960-
if (!empty(trim($replyTo->mailbox)) && !empty(trim($replyTo->host))) {
960+
if (isset($replyTo->mailbox) && !empty(trim($replyTo->mailbox)) && isset($replyTo->host) && !empty(trim($replyTo->host))) {
961961
$replyToEmail = strtolower($replyTo->mailbox.'@'.$replyTo->host);
962962
$replyToName = (isset($replyTo->personal) and !empty(trim($replyTo->personal))) ? $this->decodeMimeStr($replyTo->personal, $this->getServerEncoding()) : null;
963963
$replyToStrings[] = $replyToName ? "$replyToName <$replyToEmail>" : $replyToEmail;

0 commit comments

Comments
 (0)