Skip to content

Commit

Permalink
Merge pull request #527 from fbonzon/array_key_exists
Browse files Browse the repository at this point in the history
Prefer array_key_exists() over isset()
  • Loading branch information
Synchro committed Oct 13, 2015
2 parents 23c3589 + c2447dc commit 6b12c21
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions class.phpmailer.php
Expand Up @@ -843,13 +843,13 @@ protected function addAnAddress($kind, $address, $name = '')
return false;
}
if ($kind != 'Reply-To') {
if (!isset($this->all_recipients[strtolower($address)])) {
if (!array_key_exists(strtolower($address), $this->all_recipients)) {
array_push($this->$kind, array($address, $name));
$this->all_recipients[strtolower($address)] = true;
return true;
}
} else {
if (!isset($this->ReplyTo[strtolower($address)])) {
if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
$this->ReplyTo[strtolower($address)] = array($address, $name);
return true;
}
Expand Down Expand Up @@ -2336,7 +2336,7 @@ protected function attachAll($disposition_type, $boundary)
$type = $attachment[4];
$disposition = $attachment[6];
$cid = $attachment[7];
if ($disposition == 'inline' && isset($cidUniq[$cid])) {
if ($disposition == 'inline' && array_key_exists($cid, $cidUniq)) {
continue;
}
$cidUniq[$cid] = true;
Expand Down Expand Up @@ -3118,7 +3118,7 @@ public function getCustomHeaders()
public function msgHTML($message, $basedir = '', $advanced = false)
{
preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
if (isset($images[2])) {
if (array_key_exists(2, $images)) {
foreach ($images[2] as $imgindex => $url) {
// Convert data URIs into embedded images
if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
Expand Down

0 comments on commit 6b12c21

Please sign in to comment.