Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-10191

Duplicate output when output_handler is set in php.ini

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.8
    • Fix Version/s: 3.0.9-RC1
    • Component/s: None
    • Labels:
      None

      Description

      Currently if the following conditions hold true:

      1. output_handler is set in php.ini to ob_gzhandler;
      2. output compression is not enabled in phpbb

      then exit_handler performs a flush() call.

      However, the way ob_gzhandler is implemented is it sets content encoding headers, collects buffered output (output buffering is implicitly turned on when output_handler is used), compresses the output and prints compressed output.

      The problem is that flush call in phpbb occurs before ob_gzhandler sets the headers, which is the root of the problem and somehow after going through msg_handler the entire page output is printed a second time.

      What should happen is conditional determining whether to use ob_flush or flush in exit_handler should look at whether output buffering is active, not at gzip_compress setting, because as explained output buffering may be turned on outside of phpbb.

        Issue Links

          Activity

          Hide
          Oleg Oleg [X] (Inactive) added a comment -

          Untested and this one needs automated tests: https://github.com/p/phpbb3/compare/ticket%2F10191

          Show
          Oleg Oleg [X] (Inactive) added a comment - Untested and this one needs automated tests: https://github.com/p/phpbb3/compare/ticket%2F10191
          Hide
          Oleg Oleg [X] (Inactive) added a comment - - edited

          The condition should be inverted to be > 0 to match 10181, and ob_flush would then come before flush which would make things less awkward.

          Edit: done.

          Show
          Oleg Oleg [X] (Inactive) added a comment - - edited The condition should be inverted to be > 0 to match 10181, and ob_flush would then come before flush which would make things less awkward. Edit: done.
          Hide
          Oleg Oleg [X] (Inactive) added a comment -

          Pull request for the fix: https://github.com/phpbb/phpbb3/pull/198

          The ticket should remain open until tests are written.

          Show
          Oleg Oleg [X] (Inactive) added a comment - Pull request for the fix: https://github.com/phpbb/phpbb3/pull/198 The ticket should remain open until tests are written.
          Hide
          bantu Andreas Fischer added a comment -

          Merged pull request 198.

          Show
          bantu Andreas Fischer added a comment - Merged pull request 198.

            People

            • Assignee:
              Oleg Oleg [X] (Inactive)
              Reporter:
              Oleg Oleg [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development