From: bref at instinctiv-e dot com
Operating system: Linux 2.6.17
PHP version: 5.1.4
PHP Bug Type: Output Control
Bug description: php.ini configuration to limit the maximum buffer size
doesn't work.
Description:
------------
Output buffering doesn't respect the maximum limit as set in php.ini in
php 5.1.4 plus some earlier versions.
output_buffering=xxx
In fact it is possible to go well past the limit and consume the entire
memory allocated to the script by memory_limit causing the script to
halt.
snippet from php.ini -
If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of
'On', as
; a value for this directive (e.g., output_buffering=4096).
Reproduce code:
---------------
ini_set("zlib.output_compression",0);
ini_set("max_execution_time",5);
// set this to larger than your output_buffering=xxx limit
ini_set("memory_limit",'3M');
echo 'Maximum buffer size as set in php.ini output_buffering: ',
$limit = ini_get("output_buffering"),
'<br />';
echo '<br />','Starting OB test...','<br />';
ob_start();
// fill up the buffer 10 bytes beyond the supposed limit
for($i=0;$i<($limit+10);$i++) { echo 'a'; }
$size = ob_get_length();
ob_end_flush();
Expected result:
----------------
Expected the output buffer to respect the maximum bytes cap as set out in
php.ini output_buffering=xxxx
Actual result:
--------------
The buffer keeps on growing past the set limit, until it fills the
memory_limit or max_execution_time limits and terminates the script.
--
Edit bug report at http://bugs.php.net/?id=38285&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38285&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38285&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38285&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38285&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38285&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38285&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38285&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38285&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38285&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38285&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38285&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38285&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38285&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38285&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38285&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38285&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38285&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38285&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38285&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38285&r=mysqlcfg