| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2008-12-23 19:10 UTC] felipe@php.net
  [2008-12-28 19:52 UTC] robinf@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 00:00:01 2025 UTC | 
Description: ------------ The doc for ob_start() states: "If the optional parameter chunk_size is passed, the buffer will be flushed after any output call which causes the buffer's length to equal or exceed chunk_size . Default value 0 means that the function is called only in the end, other special value 1 sets chunk_size to 4096." In HEAD, setting $chunk_size=1 actually does set the buffer threshold size to 1 byte, rather than 4096 bytes as on 5_* and as documented. Here's a simple patch for HEAD to restore the documented behaviour: Index: output.c =================================================================== RCS file: /repository/php-src/main/output.c,v retrieving revision 1.214 diff -u -w -p -r1.214 output.c --- output.c 18 Aug 2008 07:45:59 -0000 1.214 +++ output.c 18 Dec 2008 14:23:10 -0000 @@ -1342,6 +1342,8 @@ PHP_FUNCTION(ob_start) } if (chunk_size < 0) { chunk_size = 0; + } else if (chunk_size == 1) { + chunk_size = 4096; } if (SUCCESS != php_output_start_user(output_handler, chunk_size, flags TSRMLS_CC)) { Reproduce code: --------------- <?php function flushCounter($input) { static $counter=0; return '[' . ++$counter . "] $input \n"; } // This should set the buffer size to 4096 ob_start('flushCounter', 1); // Get the buffer size: $bufferInfo = ob_get_status(true); var_dump($bufferInfo[0]['chunk_size']); // If the buffer size is >1, these two chars should // come out as part of a single flush: echo "1"; echo "2"; ?> Expected result: ---------------- [1] int(4096) 12 Actual result: -------------- [1] int(1) [2] 1 [3] 2 [4]