php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60243 Add way to specify output buffering chunk size of 1
Submitted: 2011-11-08 15:16 UTC Modified: 2011-11-11 13:18 UTC
From: artificialmagic at hotmail dot com Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: artificialmagic at hotmail dot com
New email:
PHP Version: OS:

 

 [2011-11-08 15:16 UTC] artificialmagic at hotmail dot com
Description:
------------
ob_implicit_flush does not do anything in CLI. This script never produces output:

ob_start();
ob_implicit_flush(true);
for (;;) echo '.';

A 1-byte buffer would work around it, except that specifying a chunk_size of 1 to ob_start is taken to mean 4 kilobytes. As a workaround, please make a chunk_size of -1 to ob_start a synonym for a real 1, so that output buffering can be used for filtering or for redirection without actual delay in output. Currently the smallest size that can be specified is 2 bytes, which can cause a potentially infinite wait for an extra byte.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-08 15:19 UTC] artificialmagic at hotmail dot com
Here's a proper test script. This produces [4096][4096][4096][4096][4096]...

ob_start(function($x) { return '[' . strlen($x) . ']'; }, 1);
for (;;) echo '.';

So I'd like this to produce [1][1][1][1][1][1]....

ob_start(function($x) { return '[' . strlen($x) . ']'; }, -1);
for (;;) echo '.';
 [2011-11-11 13:11 UTC] aharvey@php.net
This has actually been fixed in PHP 5.4 already as part of the output layer 
improvements: a chunk size of 1 now really means 1.

I'll morph this into a documentation bug, because it's currently not noted in the 
manual or in the upgrade notes.
 [2011-11-11 13:11 UTC] aharvey@php.net
-Status: Open +Status: Assigned -Type: Feature/Change Request +Type: Documentation Problem -Package: Output Control +Package: Documentation problem -Assigned To: +Assigned To: aharvey
 [2011-11-11 13:13 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=319050
Log: Note the change in ob_start() chunk size behaviour mentioned in doc bug #60243
(Add way to specify output buffering chunk size of 1).
 [2011-11-11 13:18 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=319051
Log: Fix doc bug #60243 (Add way to specify output buffering chunk size of 1).
 [2011-11-11 13:18 UTC] aharvey@php.net
-Status: Assigned +Status: Closed
 [2011-11-11 13:18 UTC] aharvey@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 04 05:01:28 2025 UTC