Moodle
  1. Moodle
  2. MDL-20723

"zlib.output_compression" breaks output of "admin/replace.php"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.9, 1.8.10, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6
    • Fix Version/s: 1.9.8
    • Component/s: Administration
    • Labels:
      None
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      31890

      Description

      When "zlib.output_compression" is turned on in the php.ini file, it breaks the output of "admin/replace.php". The only part that doesn't display is the section that would normally list all the queries being run. This seems to be happening in every version, but I've only confirmed versions 1.8.9 to 1.9.6. I've been able to fix it by adding the following two lines near the beginning of "admin/replace.php":

      ini_set('zlib.output_compression',false);
      ini_set('zlib.output_compression_level',-1);

        Activity

        Hide
        Dakota Duff added a comment -

        The offender is the following line (~4827) in /lib/adminlib.php:
        while(@ob_end_flush());

        Commenting this line out will give perfect output with or without zlib.output_compression.

        In /admin/index.php ob_end_clean() has been substituted for ob_end_flush() in core, with the comments "ob_end_flush prevents sending of headers".

        Interestingly, ob_end_flush() and ob_end_clean() are used in a handful of Moodle pages and they don't seem to be causing problems. The only difference I can tell with the replace.php script is that output has already started when the function is called, and indeed if ob_end_flush() is placed in replace.php before output then it runs as expected.

        Show
        Dakota Duff added a comment - The offender is the following line (~4827) in /lib/adminlib.php: while(@ob_end_flush()); Commenting this line out will give perfect output with or without zlib.output_compression. In /admin/index.php ob_end_clean() has been substituted for ob_end_flush() in core, with the comments "ob_end_flush prevents sending of headers". Interestingly, ob_end_flush() and ob_end_clean() are used in a handful of Moodle pages and they don't seem to be causing problems. The only difference I can tell with the replace.php script is that output has already started when the function is called, and indeed if ob_end_flush() is placed in replace.php before output then it runs as expected.
        Hide
        Jonathan Robson added a comment -

        I tried Dakota's fix and it works for me too.

        Show
        Jonathan Robson added a comment - I tried Dakota's fix and it works for me too.
        Hide
        Petr Škoda added a comment - - edited

        I have committed a patch that should disable the compression in admin/replace.php script, could somebody please verify it works?

        <code php>
        if (ini_get('zlib.output_compression'))

        { @ini_set('zlib.output_compression', 'Off'); }

        </code>

        thanks

        Show
        Petr Škoda added a comment - - edited I have committed a patch that should disable the compression in admin/replace.php script, could somebody please verify it works? <code php> if (ini_get('zlib.output_compression')) { @ini_set('zlib.output_compression', 'Off'); } </code> thanks
        Hide
        Jonathan Robson added a comment -

        I can confirm that Petr's fix works for me on Moodle 1.9.5 and 1.9.6 with PHP 5.2.9, 5.2.10, and 5.2.11.

        Show
        Jonathan Robson added a comment - I can confirm that Petr's fix works for me on Moodle 1.9.5 and 1.9.6 with PHP 5.2.9, 5.2.10, and 5.2.11.
        Hide
        Jonathan Robson added a comment -

        I think this can be marked as "Resolved." We have not had the problem since Petr committed his fix.

        Show
        Jonathan Robson added a comment - I think this can be marked as "Resolved." We have not had the problem since Petr committed his fix.
        Hide
        Petr Škoda added a comment -

        thanks, closing

        Show
        Petr Škoda added a comment - thanks, closing

          People

          • Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: