From: mike_harris02135 at yahoo dot com
Operating system: linux
PHP version: 4.3.10
PHP Bug Type: Sockets related
Bug description: sockets do not detect disconnect
Description:
------------
Ive been on the forums and noone seems to be able to help with this.
Im writing a jabber client with php. I connect to the server, send a
message, sleep for 20 seconds (kill the server during this time), then
send another message, and the code used to send the message does not
report any error.
Reproduce code:
---------------
function WriteToSocket($data)
{
echo "\nIn WriteToSocket: $data\n";
echo "-------------Socket = " . $this->socket . "\n";
if(socket_last_error($this->socket))
{
print "Detected error\n";
echo socket_strerror(socket_clear_error($this->socket));
}
return socket_write($this->socket, $data, strlen($data));
}
Expected result:
----------------
i expect socket_last_error to report that the socket was closed
unexpectedly. Incidently, when I create the socket i always get an error
with unknown error code, but the server receives the message just fine.
Or the socket_write method would return 0, or the socket reference would
be null.
Actual result:
--------------
The code does not indicate any error, and reports that n bytes were
written.
--
Edit bug report at http://bugs.php.net/?id=32075&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32075&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32075&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32075&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32075&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32075&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32075&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32075&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32075&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32075&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32075&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32075&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32075&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32075&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32075&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32075&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32075&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32075&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32075&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32075&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32075&r=mysqlcfg