ID:               24851
 Updated by:       [EMAIL PROTECTED]
 Reported By:      artem at osp dot ru
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: Linux 2.2.25
 PHP Version:      4.3.2
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

From:

http://uk.php.net/fread

Note: When reading from network streams or pipes, such as those
returned when reading remote files or from popen() and proc_open(),
reading will stop after a packet is available. This means that you
should collect the data together in chunks as shown in the example
below. 




Previous Comments:
------------------------------------------------------------------------

[2003-07-29 05:40:07] artem at osp dot ru

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 this bug report at http://bugs.php.net/?id=24851&edit=1

Reply via email to