Issue Details (XML | Word | Printable)

Key: MDL-20723
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Petr Skoda
Reporter: Jonathan Robson
Votes: 7
Watchers: 5
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

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

Created: 03/Nov/09 06:59 AM   Updated: 11/Nov/09 02:44 AM
Return to search
Component/s: Administration
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: None

Database: MySQL
Participants: Dakota Duff, Jonathan Robson and Petr Skoda
Security Level: None
Affected Branches: MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
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);

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Dakota Duff added a comment - 06/Nov/09 03:10 AM
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.


Jonathan Robson added a comment - 06/Nov/09 10:48 PM
I tried Dakota's fix and it works for me too.

Petr Skoda added a comment - 09/Nov/09 06:25 AM - 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


Jonathan Robson added a comment - 11/Nov/09 02:44 AM
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.