From: flebron at bumeran dot com Operating system: Fedora Linux 2 PHP version: 5.3CVS-2008-06-29 (snap) PHP Bug Type: Output Control Bug description: ob_start()/ob_end_clean() and memory_limit
Description: ------------ When memory_limit is reached, and one is using the output buffering functions, instead of just dying with an "out of memory" error, the contents of the buffer are spilled onto stdout. The output_buffering ini setting wasn't set to any particular limit. Reproduce code: --------------- <?php ob_start(); $i = 0; while($i++ < 10000000) { echo str_repeat("lol", 42); } ob_end_clean(); /*Note that the 10,000,000 number varies according to your memory_limit*/ Expected result: ---------------- STDERR: Fatal error: Allowed memory size of 134217728 bytes exhausted at /home/flebron/cvs/php/php5.3-200806291230/main/output.c:395 (tried to allocate 133693441 bytes) in /home/flebron/cvs/php/ob.php on line 5 STDOUT: Nothing Actual result: -------------- STDERR: Fatal error: Allowed memory size of 134217728 bytes exhausted at /home/flebron/cvs/php/php5.3-200806291230/main/output.c:395 (tried to allocate 133693441 bytes) in /home/flebron/cvs/php/ob.php on line 5 STDOUT: The text in the buffer is printed to stdout (millions of "lolol"s). -- Edit bug report at http://bugs.php.net/?id=45392&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45392&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45392&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45392&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45392&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45392&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45392&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45392&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45392&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45392&r=support Expected behavior: http://bugs.php.net/fix.php?id=45392&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45392&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45392&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45392&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45392&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45392&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45392&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45392&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45392&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45392&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45392&r=mysqlcfg