#41280 [NEW]: Local file reading distorts echo
From: wimroffel at planet dot nl
Operating system: Windows XP
PHP version: 5.2.2
PHP Bug Type: Filesystem function related
Bug description: Local file reading distorts echo
Description:
------------
While reading a local file Windows (both XP and ME) many empty reads are
generated (reading from internet works much better). So you need a "while
!feof" loop and cannot trust on a test on the size of $data.
The killer in the attached code is the "echo $data". The problem does not
happen if you collect the whole file in a variable and echo it at once. So
it seems some problem with echo - probably with the data produced by an
empty read.
Sometimes the crash happens after only a few freads. Other times it can
take a few dozen.
The echo problem happens only under Windows XP and not under Windows ME. I
am using Apache 2.2.
Reproduce code:
---------------
/* myfile.txt is a large (about 100k) local file */
$fpi = fopen("myfile.txt", "rb");
while(!feof($fpi)) /* block read the rest */
{ $data = fread($fpi,4096);
echo $data;
}
fclose($fpi);
Expected result:
----------------
a reproduction of the file on screen.
Actual result:
--------------
The screen flickers a few times while a partial result is produced. Then
you get a "Cannot find server" message.
Some times the first display goes right, but the problem happens after a
refresh.
--
Edit bug report at http://bugs.php.net/?id=41280&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41280&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41280&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41280&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41280&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41280&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41280&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41280&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41280&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41280&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41280&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41280&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41280&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41280&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41280&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41280&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41280&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41280&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41280&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41280&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41280&r=mysqlcfg
Thread (7 messages)
- wimroffel at planet dot nl