Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-10245

Messenger uses output buffering for error collection, should use error collector instead

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0.10-RC1
    • 3.0.9-RC2
    • None
    • None

      https://github.com/phpbb/phpbb3/blob/develop-olympus/phpBB/includes/functions_messenger.php#L1617

      ob_start();
      // 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();
      

      We now have an error collector class which should be used instead of output buffering and errors going through our error collector.

      In 3.0.9-RC2, msg_handler performs ob_flush which 1) sends output to browser before headers are sent, creating warnings, and 2) results in ob_get_clean not getting any of the output, thus defeating the entire purpose of this code.

      For 3.0.9-RC3 msg_handler will no longer flush, but the correct way to collect errors is to use the error collector.

            bantu Andreas Fischer [X] (Inactive)
            Oleg Oleg [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: