mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
MFB51: Fixed bug #35062 (socket_read() produces warnings on non blocking
sockets).
This commit is contained in:
parent
e803ebb403
commit
08c824bbea
1 changed files with 13 additions and 1 deletions
|
@ -859,7 +859,19 @@ PHP_FUNCTION(socket_read)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval == -1) {
|
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);
|
efree(tmpbuf);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue