From:             sqchen at citiz dot net
Operating system: redhat 7.3
PHP version:      5.1.1
PHP Bug Type:     Filesystem function related
Bug description:  Does fflush() readly works?

Description:
------------
Do you this think fflush() realy works? plese see following code

if you answer it's not a bug, please give me a example how to use fflush()
correctly.

Reproduce code:
---------------
----before fflush----
<?php
$fp = fopen("1.txt", "w");
while(1)
{
   fwrite($fp, "a");
   sleep(1);
}
?>
----after fflush----
<?php
$fp1 = fopen("1.txt", "w");
$fp2 = fopen("2.txt", "w");
while(1)
{
   fwrite($fp1, "a");
   fflush($fp2);
   sleep(1);
}
?>

Expected result:
----------------
---before fflush---
no contents in file "1.txt" until it's buffer is full
---after  fflush---
"a  a  a  a....." in file "2.txt" immediately

Actual result:
--------------
---before fflush---
"a  a  a  a....." in file "1.txt" immediately
---after fflush---
empty in file "2.txt"

-- 
Edit bug report at http://bugs.php.net/?id=35914&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35914&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35914&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35914&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35914&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35914&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35914&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35914&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35914&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35914&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35914&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35914&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35914&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35914&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35914&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35914&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35914&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35914&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35914&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35914&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35914&r=mysqlcfg

Reply via email to