Commit:    ac47448abb477be99963f0b38fe82ffe78c21a8b
Author:    Gustavo Lopes <glo...@nebm.ist.utl.pt>         Sat, 2 Feb 2013 
15:43:05 +0100
Parents:   e8f0e863ae48d58d2bb95e667606d7846f782d08
Branches:  PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=ac47448abb477be99963f0b38fe82ffe78c21a8b

Log:
Ignore warnings on EAGAIN/EWOULDBLOCK/EINPROGRESS

See bug #63570

Bugs:
https://bugs.php.net/63570

Changed paths:
  M  ext/sockets/php_sockets.h
  M  ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt
  M  ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt
  M  ext/sockets/tests/socket_sentto_recvfrom_unix.phpt


Diff:
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index 3762e02..9c5dc5a 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -69,7 +69,9 @@ PHP_SOCKETS_API int php_sockets_le_socket(void);
                        int _err = (errn); /* save value to avoid repeated 
calls to WSAGetLastError() on Windows */ \
                        (socket)->error = _err; \
                        SOCKETS_G(last_error) = _err; \
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s [%d]: 
%s", msg, _err, php_strerror(_err TSRMLS_CC)); \
+                       if (_err != EAGAIN && _err != EWOULDBLOCK && _err != 
EINPROGRESS) { \
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s 
[%d]: %s", msg, _err, php_strerror(_err TSRMLS_CC)); \
+                       } \
                } while (0)
 
 ZEND_BEGIN_MODULE_GLOBALS(sockets)
diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt 
b/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt
index bf95044..00d69a8 100644
--- a/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt
+++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt
@@ -14,7 +14,7 @@ if (!extension_loaded('sockets')) {
     if (!socket_set_nonblock($socket)) {
         die('Unable to set nonblocking mode for socket');
     }
-    socket_recvfrom($socket, $buf, 12, 0, $from, $port); // cause warning
+    var_dump(socket_recvfrom($socket, $buf, 12, 0, $from, $port)); //false 
(EAGAIN - no warning)
     $address = '127.0.0.1';
     socket_sendto($socket, '', 1, 0, $address); // cause warning
     if (!socket_bind($socket, $address, 1223)) {
@@ -44,7 +44,7 @@ if (!extension_loaded('sockets')) {
 
     socket_close($socket);
 --EXPECTF--
-Warning: socket_recvfrom(): unable to recvfrom [%d]: %a in %s on line %d
+bool(false)
 
 Warning: Wrong parameter count for socket_sendto() in %s on line %d
 
diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt 
b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt
index 2beb808..bd07904 100644
--- a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt
+++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt
@@ -18,7 +18,7 @@ require 'ipv6_skipif.inc';
     if (!socket_set_nonblock($socket)) {
         die('Unable to set nonblocking mode for socket');
     }
-    socket_recvfrom($socket, $buf, 12, 0, $from, $port); // cause warning
+    var_dump(socket_recvfrom($socket, $buf, 12, 0, $from, $port)); // false 
(EAGAIN, no warning)
     $address = '::1';
     socket_sendto($socket, '', 1, 0, $address); // cause warning
     if (!socket_bind($socket, $address, 1223)) {
@@ -48,7 +48,7 @@ require 'ipv6_skipif.inc';
 
     socket_close($socket);
 --EXPECTF--
-Warning: socket_recvfrom(): unable to recvfrom [11]: Resource temporarily 
unavailable in %s on line %d
+bool(false)
 
 Warning: Wrong parameter count for socket_sendto() in %s on line %d
 
diff --git a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt 
b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
index 55ad75c..e25bf4d 100644
--- a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
+++ b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
@@ -18,7 +18,7 @@ if (!extension_loaded('sockets')) {
     if (!socket_set_nonblock($socket)) {
         die('Unable to set nonblocking mode for socket');
     }
-    socket_recvfrom($socket, $buf, 12, 0, $from, $port); // cause warning
+    var_dump(socket_recvfrom($socket, $buf, 12, 0, $from, $port)); //false 
(EAGAIN, no warning)
     $address = sprintf("/tmp/%s.sock", uniqid());
     if (!socket_bind($socket, $address)) {
         die("Unable to bind to $address");
@@ -53,8 +53,7 @@ if (!extension_loaded('sockets')) {
 ?>
 --EXPECTF--
 Warning: socket_create(): Unable to create socket [%d]: Protocol not supported 
in %s on line %d
-
-Warning: socket_recvfrom(): unable to recvfrom [%d]: Resource temporarily 
unavailable in %s on line %d
+bool(false)
 
 Warning: socket_sendto() expects at least 5 parameters, 4 given in %s on line 
%d
 bool(false)


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to