Rene Pijlman:
My guess is the call to header() in the output callback saveToFileCache() is not safe. This is writing to the buffer that the output callback is processing.
if( $this->useGzip() ) { if( wfClientAcceptsGzip() ) { header( 'Content-Encoding: gzip' );
BTW, this looks conceptually flawed at this point. The encoding was already decided when the data was written to the buffer. I can't think of a reason to redecide and write this header only now.
Also I wonder if it's wise to use the output callback to write the file to the cache. That could be done earlier as well, I'd think.