From: [EMAIL PROTECTED]
Operating system: Win2K
PHP version: 4.3.0
PHP Bug Type: Sockets related
Bug description: feof() doesn't returns true on a socket stream
The following code doesn't work with php4.3.0
As foef() never returns true it got stuck in the while()-loop...
When running the same code in php4.2.3 it works as it should so it seems
like a 4.3.0 issue...
( feof() returns true in 4.2.3... )
The scenario consists of the script connecting to a host which immediatly
replies with a textstring; "OK", which in turn is printed out...
/Regards
Bjarne
// Open a socket and connects to the host
$fp = fsockopen ($myhost, $myport, $errno, $errstr, 30);
// check for valid filepointer
if (!$fp)
{
echo "$errstr ($errno)<br>\n";
}
else
{
// sets the socket to non-blocking
socket_set_blocking($fp,FALSE);
// read data from socket upto EOF in 128 byte chunks
while (!feof($fp)) // <= FAILS IN PHP 4.3.0!!!!!
{
$buffer .= fgets ($fp,128);
}
// closing socket
fclose ($fp);
// printing the buffer
print "Buffer:" . $buffer;
}
--
Edit bug report at http://bugs.php.net/?id=21485&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21485&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21485&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21485&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21485&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21485&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21485&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21485&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21485&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21485&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21485&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21485&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21485&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21485&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21485&r=gnused