php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23926 CLI buffers when it's not supposed to.
Submitted: 2003-05-31 13:35 UTC Modified: 2003-05-31 20:41 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jkitching at mailbolt dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.2 OS: Linux plebb 2.4.20 #15 Sat May 1
Private report: No CVE-ID: None
 [2003-05-31 13:35 UTC] jkitching at mailbolt dot com
At http://ca2.php.net/features.commandline it says this:

" There are certain php.ini directives which are overriden by the CLI SAPI because they do not make sense in shell environments: "

Then it lists the overriden php.ini directives, which includes inplicit_flush, defaulting it to true.


So theoretically, CLI shouldn't buffer.  This is true with the RC releases of 4.3.2, but with the final release, it BUFFERS!
And I mean it really buffers.  I tried flush() and ob_implicit_flush();, but it still only outputs at the end of the script.  Here is a sample script:

<?php
echo 'This should be printed immediately.';
sleep(5);
?>

When executing this script at the command line, it outputs "This should be printed immediately." after a wait of 5 seconds.  This tells us that it is buffering.

I hope someone would email me if this program acts differently on their computer, or if the bug is fixed.  My email is jkitching@mailbolt.com

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-31 20:41 UTC] edink@php.net
CLI will honour output buffering directive from php.ini (this is a different issue from implicit_flush). Either remove that ini entry or run CLI with -n (ignore ini file) option. 
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jul 07 04:03:36 2022 UTC