|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-04 10:31 UTC] tony2001@php.net
[2007-05-04 13:09 UTC] wimroffel at planet dot nl
[2007-05-04 13:19 UTC] tony2001@php.net
[2007-05-04 18:59 UTC] wimroffel at planet dot nl
[2007-05-04 19:56 UTC] tony2001@php.net
[2007-05-07 02:01 UTC] dayseye at 21cn dot com
[2007-05-12 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 00:00:02 2025 UTC |
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.