Skip to content

Commit

Permalink
Make edebug behave the same way in PHPMailer and SMTP classes - alway…
Browse files Browse the repository at this point in the history
…s output in UTF-8, see PHPMailer#263
  • Loading branch information
Synchro committed Aug 11, 2014
1 parent 9a4646e commit 819b9cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 11 additions & 5 deletions class.phpmailer.php
Expand Up @@ -618,27 +618,33 @@ private function mailPassthru($to, $subject, $body, $header, $params)

/**
* Output debugging info via user-defined method.
* Only if debug output is enabled.
* Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
* @see PHPMailer::$Debugoutput
* @see PHPMailer::$SMTPDebug
* @param string $str
*/
protected function edebug($str)
{
if (!$this->SMTPDebug) {
if ($this->SMTPDebug <= 0) {
return;
}
switch ($this->Debugoutput) {
case 'error_log':
//Don't output, just log
error_log($str);
break;
case 'html':
//Cleans up output a bit for a better looking display that's HTML-safe
echo htmlentities(preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, $this->CharSet) . "<br>\n";
//Cleans up output a bit for a better looking, HTML-safe output
echo htmlentities(
preg_replace('/[\r\n]+/', '', $str),
ENT_QUOTES,
'UTF-8'
)
. "<br>\n";
break;
case 'echo':
default:
echo $str."\n";
echo gmdate('Y-m-d H:i:s') . "\t" . trim($str) . "\n";
}
}

Expand Down
2 changes: 2 additions & 0 deletions class.smtp.php
Expand Up @@ -146,6 +146,8 @@ class SMTP

/**
* Output debugging info via a user-selected method.
* @see SMTP::$Debugoutput
* @see SMTP::$do_debug
* @param string $str Debug string to output
* @return void
*/
Expand Down

0 comments on commit 819b9cb

Please sign in to comment.