From: paul at wcclan dot net Operating system: FreeBSD 7.2-RELEASE-p4 PHP version: 5.2.11 PHP Bug Type: Output Control Bug description: output corruption using flush
Description: ------------ Looping through the output of a process opened with popen while using flush return "garbage" in the browser. Using telnet the intended output can be seen in (likely corrupted) chuncked encoding. Commenting out the flush() in below code fixes the problem. Reproduce code: --------------- <? $handle = popen("whois php.net", "r"); if($handle) { while(!feof($handle)) { $buffer = fgets($handle); echo $buffer . "<br />\r\n"; flush(); } pclose($handle); } ?> Expected result: ---------------- the output of the command whois php.net Actual result: -------------- seemingly random garbage in browser. Above script available through: http://ipv6.wcclan.net/test.php -- Edit bug report at http://bugs.php.net/?id=49816&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49816&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49816&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49816&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49816&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49816&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49816&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49816&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49816&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49816&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49816&r=support Expected behavior: http://bugs.php.net/fix.php?id=49816&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49816&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49816&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49816&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49816&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49816&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49816&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49816&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49816&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49816&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49816&r=mysqlcfg