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

From: Date: Sun, 31 Dec 2000 00:56:53 +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-42593@lists.php.net to get a copy of this message
ID: 7862 Updated by: sniper Reported By: burwitz@mails-media.de Old-Status: Feedback Status: Closed Bug Type: Filesystem function related Assigned To: Comments: No feedback. --Jani Previous Comments: --------------------------------------------------------------------------- [2000-11-21 07:27:19] stas@php.net 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. --------------------------------------------------------------------------- [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 (#42593) next »