Skip to content

Commit

Permalink
Merge pull request #405 from barbushin/develop
Browse files Browse the repository at this point in the history
Added PHP 7.4 support and additional checks
  • Loading branch information
Sebbo94BY authored Nov 30, 2019
2 parents 87fba0f + 7b6a42a commit 3ac294a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ php:
- 7.1
- 7.2
- 7.3
# - 7.4 # Not supported yet (2019-11-12)
# - 8.0 # Not supported yet (2019-11-12)
- 7.4snapshot

before_script:
- composer install --no-interaction
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Initially released in December 2012, the PHP IMAP Mailbox is a powerful and open

### Requirements

* PHP 5.6, 7.0, 7.1, 7.2 or 7.3
* PHP 5.6, 7.0, 7.1, 7.2, 7.3 or 7.4
* PHP `imap` extension must be present; so make sure this line is active in your php.ini: `extension=php_imap.dll`
* PHP `mbstring` extension must be present; so make sure this line is active in your php.ini: `extension=php_mbstring.dll`
* 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`
Expand Down
8 changes: 4 additions & 4 deletions src/PhpImap/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ public function getMailHeader($mailId)
if (isset($head->to)) {
$toStrings = [];
foreach ($head->to as $to) {
if (!empty($to->mailbox) && !empty(trim($to->host))) {
if (isset($to->mailbox) && !empty(trim($to->mailbox)) && isset($to->host) && !empty(trim($to->host))) {
$toEmail = strtolower($to->mailbox.'@'.$to->host);
$toName = (isset($to->personal) and !empty(trim($to->personal))) ? $this->decodeMimeStr($to->personal, $this->getServerEncoding()) : null;
$toStrings[] = $toName ? "$toName <$toEmail>" : $toEmail;
Expand All @@ -935,7 +935,7 @@ public function getMailHeader($mailId)

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

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

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

0 comments on commit 3ac294a

Please sign in to comment.