mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge remote-tracking branch 'github-bantu/ticket/10245' into develop-olympus
* github-bantu/ticket/10245: [ticket/10245] Use error_collector instead of ob_start() and ob_get_clean().
This commit is contained in:
commit
410028eecf
1 changed files with 21 additions and 5 deletions
|
@ -975,9 +975,16 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false)
|
||||||
$smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']);
|
$smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']);
|
||||||
|
|
||||||
// Ok we have error checked as much as we can to this point let's get on it already.
|
// Ok we have error checked as much as we can to this point let's get on it already.
|
||||||
ob_start();
|
if (!class_exists('phpbb_error_collector'))
|
||||||
|
{
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
|
||||||
|
}
|
||||||
|
$collector = new phpbb_error_collector;
|
||||||
|
$collector->install();
|
||||||
$smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20);
|
$smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20);
|
||||||
$error_contents = ob_get_clean();
|
$collector->uninstall();
|
||||||
|
$error_contents = $collector->format_errors();
|
||||||
|
|
||||||
if (!$smtp->socket)
|
if (!$smtp->socket)
|
||||||
{
|
{
|
||||||
|
@ -1608,18 +1615,27 @@ function mail_encode($str, $eol = "\r\n")
|
||||||
*/
|
*/
|
||||||
function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg)
|
function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
// We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used...
|
// We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used...
|
||||||
// Reference: http://bugs.php.net/bug.php?id=15841
|
// Reference: http://bugs.php.net/bug.php?id=15841
|
||||||
$headers = implode($eol, $headers);
|
$headers = implode($eol, $headers);
|
||||||
|
|
||||||
ob_start();
|
if (!class_exists('phpbb_error_collector'))
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
$collector = new phpbb_error_collector;
|
||||||
|
$collector->install();
|
||||||
|
|
||||||
// On some PHP Versions mail() *may* fail if there are newlines within the subject.
|
// On some PHP Versions mail() *may* fail if there are newlines within the subject.
|
||||||
// Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8.
|
// Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8.
|
||||||
// Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used)
|
// Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used)
|
||||||
$result = $config['email_function_name']($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers);
|
$result = $config['email_function_name']($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers);
|
||||||
$err_msg = ob_get_clean();
|
|
||||||
|
$collector->uninstall();
|
||||||
|
$err_msg = $collector->format_errors();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue