php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38285 php.ini configuration to limit the maximum buffer size doesn't work.
Submitted: 2006-08-01 17:33 UTC Modified: 2006-08-01 17:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bref at instinctiv-e dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.1.4 OS: Linux 2.6.17
Private report: No CVE-ID: None
 [2006-08-01 17:33 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-01 17:40 UTC] mike@php.net
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
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 25 04:01:27 2025 UTC