Bug #66928 [NEW]: ob_start()/ob_end_clean() and memory_limit

From: Date: Tue, 18 Mar 2014 19:56:51 +0000
Subject: Bug #66928 [NEW]: ob_start()/ob_end_clean() and memory_limit
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184826@lists.php.net to get a copy of this message
From: leon at struktur dot de Operating system: * PHP version: Irrelevant Package: Output Control Bug Type: Bug Bug description:ob_start()/ob_end_clean() and memory_limit Description: ------------ COPY FROM : https://bugs.php.net/bug.php?id=45392 STILL NOT FIXED, BUT BUG IS CLOSED !! 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. Test script: --------------- <?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 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 https://bugs.php.net/bug.php?id=66928&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66928&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66928&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66928&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66928&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66928&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66928&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66928&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66928&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66928&r=support Expected behavior: https://bugs.php.net/fix.php?id=66928&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66928&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66928&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66928&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66928&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66928&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66928&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66928&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66928&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66928&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66928&r=mysqlcfg

« previous php.bugs (#184826) next »