#24782 [Opn->Bgs]: fread'ing with large buffers from slow pages does not work

From: Date: Thu, 24 Jul 2003 00:35:19 +0000
Subject: #24782 [Opn->Bgs]: fread'ing with large buffers from slow pages does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44625@lists.php.net to get a copy of this message
 ID:               24782
 Updated by:       wez@php.net
 Reported By:      odarcan at hotmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Network related
 Operating System: win xp
 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

reading from sockets will give you a packet sized chunk which can be
less than the buffer size you requested.
This is documented in the manual and has been the behaviour since
sockets were introduced to PHP.

Note that 4.3.0 and 4.3.1 were broken in that they would block your
whole script to try to fulfill your request - breaking other peoples
scripts.


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

[2003-07-23 19:22:46] odarcan at hotmail dot com

Description:
------------
$pcstring=fread ($pcpointer,1000);
$pcstring.=fread ($pcpointer,1000);
$pcstring.=fread ($pcpointer,1000);
$pcstring.=fread ($pcpointer,1000);
$pcstring.=fread ($pcpointer,1000);

is NOT the same as

$string=fread ($pcpointer,5000);

at least not in slow opening pages (as php scripts doing calculations)

the second code only gives the headers while skipping the rest while
the first shows echoed results from the php script (as it did with
previous versions of php)

putting a sleep(1); before the fread also solves this (for me at
least).

sleep(1);
$string=fread ($pcpointer,5000);


it has taken me 5 days to figure out what was wrong, FIVE DAYS...




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24782&edit=1



Thread (5 messages)

« previous php.bugs (#44625) next »