Page MenuHomePhabricator

Resource Loader tryRespondLastModified has a poorly written loop when clearing the output buffer.
Closed, ResolvedPublic

Description

Author: necrohem

Description:
Applies to:
protected function tryRespondLastModified( ResourceLoaderContext $context, $mtime )

The function is small, so I'll let the code speak for itself. Basically, in the existing version the value retuned by ob_get_level() will count down as $i counts up - this results in only half of the ob levels getting cleared. Ultimately, this leads to bytes in the body section of the 304 (which is illegal and chokes browsers).

Here is the existing code:
for ( $i = 0; $i < ob_get_level(); $i++ ) {

ob_end_clean();

}

Here is what it should be:
$tmp = ob_get_level();
for ( $i = 0; $i < $tmp; $i++ ) {

ob_end_clean();

}


Version: 1.19.1
Severity: major

Details

Reference
bz61359

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:53 AM
bzimport set Reference to bz61359.
bzimport added a subscriber: Unknown Object (MLST).

Looks like this is already handled in master with bug 46836

Yeah, this is bug 46836 comment 5. Thanks for catching this, Umherirrender!

Jon: In case you would like to propose the patch for backporting to a future 1.19.x tarball release, please add a comment to bug 46836. Thanks!

  • This bug has been marked as a duplicate of bug 46836 ***