From: suguru at sak dot iis dot u-tokyo dot ac dot jp Operating system: Linux, Solaris PHP version: 5.0.0 PHP Bug Type: Output Control Bug description: not flush stdout in pipe command which ob_handler and with-apxs2 configuration
Description: ------------ 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(|). point: 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. solution: call flush() at the exit point of script. Reproduce code: --------------- ----test.php---- <?php $dat="01234567890123456789012345678901234567890123456789\n"; 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. -- Edit bug report at http://bugs.php.net/?id=29544&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29544&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29544&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29544&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29544&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29544&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29544&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29544&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29544&r=support Expected behavior: http://bugs.php.net/fix.php?id=29544&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29544&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29544&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29544&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29544&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29544&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29544&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29544&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29544&r=float