|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-01 17:40 UTC] mike@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 20:00:01 2025 UTC |
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.