From: artem at osp dot ru
Operating system: Linux 2.2.25
PHP version: 4.3.2
PHP Bug Type: Filesystem function related
Bug description: fread on popen slow pipe return only part of content
Description:
------------
on slow pipes opened by popen fread return data to script before length
bytes have been read or EOF (end of file) reached.
may be it's not bug, but feature, but in this case, this feature must be
documented.
may be it's double #19783
Reproduce code:
---------------
<?php
ob_implicit_flush(1);
echo "<b>".date("r")."</b><br>\n";
$fp=popen('for i in 1 2 3 4 5 6 7 8 9; do echo $i ; sleep 1 ;
done',"r");
while(!feof($fp)) {
$s=fread($fp,100000);
echo "<b>".date("r")."</b><pre>$s</pre>\n";
}
pclose($fp);
?>
Expected result:
----------------
Tue, 29 Jul 2003 14:27:51 +0400
Tue, 29 Jul 2003 14:27:60 +0400
1
2
3
4
5
6
7
8
9
Actual result:
--------------
Tue, 29 Jul 2003 14:26:01 +0400
Tue, 29 Jul 2003 14:26:01 +0400
1
Tue, 29 Jul 2003 14:26:02 +0400
2
Tue, 29 Jul 2003 14:26:03 +0400
3
Tue, 29 Jul 2003 14:26:04 +0400
4
Tue, 29 Jul 2003 14:26:05 +0400
5
Tue, 29 Jul 2003 14:26:06 +0400
6
Tue, 29 Jul 2003 14:26:07 +0400
7
Tue, 29 Jul 2003 14:26:08 +0400
8
Tue, 29 Jul 2003 14:26:09 +0400
9
Tue, 29 Jul 2003 14:26:10 +0400
--
Edit bug report at http://bugs.php.net/?id=24851&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24851&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24851&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24851&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24851&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24851&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24851&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24851&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24851&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24851&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24851&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24851&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24851&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24851&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24851&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24851&r=gnused