#38285 [Opn->Bgs]: php.ini configuration to limit the maximum buffer size doesn't work.
| From: | mike@php.net | Date: | Tue, 01 Aug 2006 17:40:12 +0000 |
| Subject: | #38285 [Opn->Bgs]: php.ini configuration to limit the maximum buffer size doesn't work. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100190@lists.php.net to get a copy of this message | ||
ID: 38285
Updated by: mike@php.net
Reported By: bref at instinctiv-e dot com
-Status: Open
+Status: Bogus
Bug Type: Output Control
Operating System: Linux 2.6.17
PHP Version: 5.1.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
http://php.net/ob_start
INI output_buffering=NNNN starts its own output buffer
Previous Comments:
------------------------------------------------------------------------
[2006-08-01 17:33:37] bref at instinctiv-e dot com
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 this bug report at http://bugs.php.net/?id=38285&edit=1