|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29544 not flush stdout in pipe command which ob_handler and with-apxs2 configuration
Submitted: 2004-08-06 10:41 UTC Modified: 2005-03-19 01:00 UTC
From: suguru at sak dot iis dot u-tokyo dot ac dot jp Assigned:
Status: No Feedback Package: Output Control
PHP Version: 5.0.0 OS: Linux, Solaris
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: suguru at sak dot iis dot u-tokyo dot ac dot jp
New email:
PHP Version: OS:


 [2004-08-06 10:41 UTC] suguru at sak dot iis dot u-tokyo dot ac dot jp
PHP version: 5.0.0, CVS(2004-08-06 06:30)
PHP5 configuration: '--with-apxs2' and '--mbstring' (when 'output_handler=mb_output_handler')
php.ini: specify 'output_handler=ob_gzhandler' or 'output_handler=mb_output_handler'
Apache version: 2.0.50
OS and compiler: Linux(debian)+gcc-3.3.4, Solaris8+gcc-3.3.3

In above configuration, php(cli version) does not flush tail of stdout when output to pipe(|).

 1. PHP is cli version (not apache2handler, but it is configurated with '--with-apxs2'.)
 2. Only when 'output_handler' is specified in php.ini.
    No effect ob_start()/ob_end_*() in PHP script.
 3. Only when Unix pipe(|) output. Normal output is correct.

  call flush() at the exit point of script.

Reproduce code:
for( $l = 0; $l < 100; ++$l ){
  print sprintf( "%2d ", $l ) . $dat;

---- ./php.ini ----
use php.ini-recommended adding 'output_handler=ob_gzhandler' or 'output_handler=mb_output_handler'.

---- execute ----
./sapi/cli/php -c ./php.ini test.php | tail -5

Expected result:
95 01234567890123456789012345678901234567890123456789
96 01234567890123456789012345678901234567890123456789
97 01234567890123456789012345678901234567890123456789
98 01234567890123456789012345678901234567890123456789
99 01234567890123456789012345678901234567890123456789

Actual result:
67 01234567890123456789012345678901234567890123456789
68 01234567890123456789012345678901234567890123456789
69 01234567890123456789012345678901234567890123456789
70 01234567890123456789012345678901234567890123456789
71 0123456789012345678901234567890123456789012

note: not exactly same result in case of diffent OS and so on.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-06 20:53 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-03-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 01 06:05:54 2022 UTC