Skip to content

Commit

Permalink
Logging email fails array to string conversion
Browse files Browse the repository at this point in the history
Array to string conversion fails at class Email.php line 2087.
The _logDelivery function under Email.php is trying to convert an array to a string and it's failing as expected.
  • Loading branch information
obinoob committed Sep 4, 2017
1 parent 3f9caaa commit aa5a012
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Mailer/Email.php
Expand Up @@ -2060,7 +2060,8 @@ public function send($content = null)

return $contents;
}



/**
* Log the email message delivery.
*
Expand All @@ -2084,10 +2085,20 @@ protected function _logDelivery($contents)
}
Log::write(
$config['level'],
PHP_EOL . $contents['headers'] . PHP_EOL . PHP_EOL . $contents['message'],
PHP_EOL . $this->_isKeyArray($contents['headers']) . PHP_EOL . PHP_EOL . $this->_isKeyArray($contents['message']),
$config['scope']
);
}


/**
* @param null $key
* @return null|string
*/
private function _isKeyArray($key = null)
{
return is_array($key) ? implode(';', $key) : $key;
}

/**
* Static method to fast create an instance of \Cake\Mailer\Email
Expand Down

0 comments on commit aa5a012

Please sign in to comment.