php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26755 PHP in CLI mode uses output_buffering
Submitted: 2003-12-31 08:37 UTC Modified: 2004-01-02 17:27 UTC
From: andrey@php.net Assigned:
Status: Closed Package: Output Control
PHP Version: 4CVS-2003-12-31 (stable) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: andrey@php.net
New email:
PHP Version: OS:

 

 [2003-12-31 08:37 UTC] andrey@php.net
Description:
------------
In CLI implicit_flush is default to 1, however when using the reproducing code implicit_flush is not used but the value of output_buffering is taken into account. If output_buffering is 0 in php.ini then everything is fine but if in php.ini the value is 4096 (or probably some value that is > 0) the output is buffered no matter it's in CLI mode. Evenmore, flush()-ing also has no effect as can be seen in the actual output.
This behaviour exists both in PHP_4_3 and in HEAD.



Reproduce code:
---------------
php -r 'echo printf("phpversion=%s\noutput_buffering=%s\nimplicit_flush=%s\n", phpversion(),ini_get("output_buffering"), ini_get("implicit_flush"));flush();$a="fubar\n"; echo $a; fubar_func();'

Expected result:
----------------
As can be seen on execution 1 and 2 of the actual result PHP dies after a fatal error of calling undefined function and after that the output which is output before the call is feed to the console.
Execution 3 and 4 show the behaviour which is expected to be normal but is only valid when output_buffering is 0 (implicit_flush as it can be seen is not taken into account).

Actual result:
--------------
Exection 1:
PHP Fatal error:  Call to undefined function fubar_func() in Command line code on line 1
phpversion=5.0.0RC1-dev
output_buffering=4096
implicit_flush=1
fubar

Execution 2:
phpversion=5.0.0RC1-dev
output_buffering=0
implicit_flush=1
fubar
PHP Fatal error:  Call to undefined function fubar_func() in Command line code on line 1


Execution 3:
PHP Fatal error:  Call to undefined function:  fubar_func() in Command line code on line 1
phpversion=4.3.5-dev
output_buffering=4096
implicit_flush=1
fubar

Execution 4:
phpversion=4.3.5-dev
output_buffering=0
implicit_flush=1
fubar
PHP Fatal error:  Call to undefined function:  fubar_func() in Command line code on line 1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-02 17:16 UTC] andrey@php.net
Changing the description to be more appropriate. Looks like implicit_flush has nothing in common with output_buffering but does not mean that there is no problem. output_buffering from php.ini should be overriden(not used by default) in CLI mode.
 [2004-01-02 17:27 UTC] edink@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC