PHP 4.0 Bug #7862 Updated: On a network connection fgetc hangs when NULL bytes get involved
| From: | stas@php.net | Date: | Tue, 21 Nov 2000 12:27:20 +0000 |
| Subject: | PHP 4.0 Bug #7862 Updated: On a network connection fgetc hangs when NULL bytes get involved | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38807@lists.php.net to get a copy of this message | ||
ID: 7862
Updated by: stas
Reported By: burwitz@mails-media.de
Status: Feedback
Bug Type: Filesystem function related
Assigned To:
Comments:
I don't see a bug here. At least on my system, it reads 8
characters, and then waits for the next one - since eof is
not signalled until the connection is closed. So it's
completely OK. Please check that it indeed sends 8
characters and reads only 6 and then hangs - I was unable to
reproduce this on my system.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-17 05:41:50] burwitz@mails-media.de
I have the following problem:
$fp =fsockopen($server, 8611, &$errno, &$errstr);
while(feof($fp)!=true) {
echo "X"; # for debuging
flush(); # for debuging
fflush($fp); # for debuging
$str.=fgetc($fp); # or fgets($fp,2); or fread($fp,1);
echo "Y"; # for debuging
flush(); # for debuging
fflush($fp); # for debuging
} # while
Would produce "XYXYXYXYXYXYX"
When the received data looks like "%00%0A%00%00%00%00%00%00"
in HEX. That means at the last character which is a NULL-byte
the fgetc or fgets or fread would hang!
BUT fread($fp,8); works! But I need it for variable length as
well!
Thanks for the help
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7862