PHP Classes

Output Buffer test isn't quite right...

Recommend this page to a friend!

      Zip Stream  >  All threads  >  Output Buffer test isn't quite right...  >  (Un) Subscribe thread alerts  
Subject:Output Buffer test isn't quite right...
Summary:Change to test for output buffer contents.
Messages:2
Author:Richard Munroe
Date:2011-02-19 23:06:16
Update:2011-02-20 06:39:10
 

  1. Output Buffer test isn't quite right...   Reply   Report abuse  
Picture of Richard Munroe Richard Munroe - 2011-02-19 23:06:16
The following on our production server:

if (ob_get_contents() === false or die("\n<p><strong>Error:</strong> Unable to send file <strong>$archiveName.epub</strong>. Output buffer contains the following text (typically warnings or errors):<br>" . ob_get_contents() . "</p>")) {


fails when the output buffer contains a null string but will successfully write a zip file under these circumstances. I tweaked the class to check for the null string as well as === false and things work just fine.

Best,

Dick Munroe

  2. Re: Output Buffer test isn't quite right...   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2011-02-20 06:39:10 - In reply to message 1 from Richard Munroe
Thanks for pointing that one out. I'll be updating the class today with a similar change: (ob_get_contents() === false || ob_get_contents() == '')

Cheers,
Asbjørn