#49816 [NEW]: output corruption using flush
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
Thread (31 messages)
- paul at wcclan dot net
- Sjoerd@php.net#49816 [Opn->Fbk]: output corruption using flush
- paul at wcclan dot net#49816 [Com]: output corruption using flush
- paul at wcclan dot net#49816 [Fbk->Opn]: output corruption using flush
- paul at wcclan dot net#49816 [Opn]: output corruption using flush
- alec at alec dot pl#49816 [Com]: output corruption using flush
- radek at pinkbike dot com#49816 [Com]: output corruption using flush
- jani@php.net#49816 [Opn->Fbk]: output corruption using flush
- jani@php.net#49816 [Fbk]: output corruption using flush
- alec at alec dot pl#49816 [Com]: output corruption using flush
- jani@php.net#49816 [Fbk->Opn]: output corruption using flush
- paul at wcclan dot net#49816 [Opn]: output corruption using flush
- paul at wcclan dot net#49816 [Opn]: output corruption using flush
- jani@php.net#49816 [Opn->Fbk]: output corruption using flush
- srinatar@php.net#49816 [Fbk->Opn]: output corruption using flush
- jani@php.net#49816 [Opn->Asn]: output corruption using flush
- jani@php.net#49816 [Asn]: output corruption using flush
- jani@php.net#49816 [Asn]: output corruption using flush
- jani@php.net#49816 [Asn]: output corruption using flush
- magnusf at users dot sourceforge dot net#49816 [Com]: output corruption using flush
- jani@php.net#49816 [Asn]: output corruption using flush
- jani@php.net#49816 [Asn]: output corruption using flush
- paul at wcclan dot net#49816 [Asn]: output corruption using flush
- jani@php.net#49816 [Asn]: output corruption using flush
- php at fostam dot franken dot de#49816 [Com]: output corruption using flush
- admin4bsd at gmail dot com#49816 [Com]: output corruption using flush
- alec at alec dot pl#49816 [Com]: output corruption using flush
- ben at xnode dot org#49816 [Com]: output corruption using flush
- gunesin_gozyaslari_0505 at hotmail dot com#49816 [Com]: output corruption using flush
- johannes@php.netBug #49816 [Asn->Bgs]: output corruption using flush
- paul at wcclan dot netBug #49816 [Bgs]: output corruption using flush