diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2005-12-04 17:31:40 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2005-12-04 17:31:40 +0000 |
commit | 08c824bbea992b823404d0cc99b0f4462d73085c (patch) | |
tree | 4bf3f106af8264ebe348748f65a833270edacd43 | |
parent | e803ebb4035316f90286362003ea28dfdb00efc2 (diff) | |
download | php-git-08c824bbea992b823404d0cc99b0f4462d73085c.tar.gz |
MFB51: Fixed bug #35062 (socket_read() produces warnings on non blocking
sockets).
-rw-r--r-- | ext/sockets/sockets.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 9987856058..2b7085c18d 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -859,7 +859,19 @@ PHP_FUNCTION(socket_read) } if (retval == -1) { - PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno); + /* if the socket is in non-blocking mode and there's no data to read, + don't output any error, as this is a normal situation, and not an error */ + if (errno == EAGAIN +#ifdef EWOULDBLOCK + || errno == EWOULDBLOCK +#endif + ) { + php_sock->error = errno; + SOCKETS_G(last_error) = errno; + } else { + PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno); + } + efree(tmpbuf); RETURN_FALSE; } |