diff options
author | Nils Adermann <naderman@naderman.de> | 2011-09-18 23:25:57 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-09-18 23:25:57 +0200 |
commit | d0f5b527febe02063d0932bb9fb6ca6e893cd1f6 (patch) | |
tree | f4efdbebf3365071712bd4a96280670b88e344f1 | |
parent | 2731e5a456a6d3da0b8926f63b2a4d440bfe439e (diff) | |
parent | 410028eecf7a6d8a7c2a66a81e91995de2447e4f (diff) | |
download | forums-d0f5b527febe02063d0932bb9fb6ca6e893cd1f6.tar forums-d0f5b527febe02063d0932bb9fb6ca6e893cd1f6.tar.gz forums-d0f5b527febe02063d0932bb9fb6ca6e893cd1f6.tar.bz2 forums-d0f5b527febe02063d0932bb9fb6ca6e893cd1f6.tar.xz forums-d0f5b527febe02063d0932bb9fb6ca6e893cd1f6.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10245] Use error_collector instead of ob_start() and ob_get_clean().
-rw-r--r-- | phpBB/includes/functions_messenger.php | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 1866733545..b94957a85f 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -976,9 +976,16 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) $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. - 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); - $error_contents = ob_get_clean(); + $collector->uninstall(); + $error_contents = $collector->format_errors(); if (!$smtp->socket) { @@ -1609,18 +1616,27 @@ function mail_encode($str, $eol = "\r\n") */ 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... // Reference: http://bugs.php.net/bug.php?id=15841 $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. // 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) $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; } |