Re: PHP 4.0 Bug #7862 Updated: On a network connection fgetc hangs when NULL bytes get involved

From: Date: Tue, 21 Nov 2000 13:16:18 +0000
Subject: Re: PHP 4.0 Bug #7862 Updated: On a network connection fgetc hangs when NULL bytes get involved
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-38813@lists.php.net to get a copy of this message
Hello, the problems seems to have to do with urlencode(). Since I used this function for test output of the binary data. removing a "echo urlencode($somebinarydata);" before the loop did the job. It definitely must have to do with it, no syntax errors or other problems and I tried all kind of test outputs on different places and I very often had this misbehaviour. Sorry I did not update my report but the login stragly never works for adding comments. Kind regards Victor Burwitz Bug Database wrote: > > 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

« previous php.dev (#38813) next »