Commit:    59ec22b370a74e9af62fdea68550feade6f36c81
Author:    Gustavo Lopes <glo...@nebm.ist.utl.pt>         Sun, 24 Feb 2013 
03:40:22 +0100
Parents:   189fbfd53b087099689b9198407ee0c50b17fc61
Branches:  PHP-5.5 master

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

Log:
sendrecvmsg_shutdown function moved to mshutdown

The function php_socket_sendrecvmsg_shutdown() should have been called in
MSHUTDOWN, not RSHUTDOWN.

Bug only on TSRM builds.

Should fix bug #64287.

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

Changed paths:
  M  NEWS
  M  ext/sockets/sockets.c


Diff:
diff --git a/NEWS b/NEWS
index 2fb0da7..b75c052 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP                                                            
            NEWS
   . Fixed bug #49348 (Uninitialized ++$foo->bar; does not cause a notice).
     (Stas)
 
+- Sockets:
+  . Fixed bug #64287 (sendmsg/recvmsg shutdown handler causes segfault).
+    (Gustavo)
+
 21 Feb 2013, PHP 5.5.0 Alpha 5
 
 - Core:
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 5ecc014..f305fa0 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -69,7 +69,6 @@
 #include "sendrecvmsg.h"
 
 ZEND_DECLARE_MODULE_GLOBALS(sockets)
-static PHP_GINIT_FUNCTION(sockets);
 
 #ifndef MSG_WAITALL
 #ifdef LINUX
@@ -271,9 +270,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_cmsg_space, 0, 0, 2)
 ZEND_END_ARG_INFO()
 /* }}} */
 
-PHP_MINIT_FUNCTION(sockets);
-PHP_MINFO_FUNCTION(sockets);
-PHP_RSHUTDOWN_FUNCTION(sockets);
+static PHP_GINIT_FUNCTION(sockets);
+static PHP_MINIT_FUNCTION(sockets);
+static PHP_MSHUTDOWN_FUNCTION(sockets);
+static PHP_MINFO_FUNCTION(sockets);
+static PHP_RSHUTDOWN_FUNCTION(sockets);
 
 PHP_FUNCTION(socket_select);
 PHP_FUNCTION(socket_create_listen);
@@ -356,7 +357,7 @@ zend_module_entry sockets_module_entry = {
        "sockets",
        sockets_functions,
        PHP_MINIT(sockets),
-       NULL,
+       PHP_MSHUTDOWN(sockets),
        NULL,
        PHP_RSHUTDOWN(sockets),
        PHP_MINFO(sockets),
@@ -607,7 +608,7 @@ static PHP_GINIT_FUNCTION(sockets)
 
 /* {{{ PHP_MINIT_FUNCTION
  */
-PHP_MINIT_FUNCTION(sockets)
+static PHP_MINIT_FUNCTION(sockets)
 {
        le_socket = zend_register_list_destructors_ex(php_destroy_socket, NULL, 
le_socket_name, module_number);
 
@@ -728,9 +729,19 @@ PHP_MINIT_FUNCTION(sockets)
 }
 /* }}} */
 
+/* {{{ PHP_MSHUTDOWN_FUNCTION
+ */
+static PHP_MSHUTDOWN_FUNCTION(sockets)
+{
+       php_socket_sendrecvmsg_shutdown(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+
+       return SUCCESS;
+}
+/* }}} */
+
 /* {{{ PHP_MINFO_FUNCTION
  */
-PHP_MINFO_FUNCTION(sockets)
+static PHP_MINFO_FUNCTION(sockets)
 {
        php_info_print_table_start();
        php_info_print_table_row(2, "Sockets Support", "enabled");
@@ -739,13 +750,12 @@ PHP_MINFO_FUNCTION(sockets)
 /* }}} */
 
 /* {{{ PHP_RSHUTDOWN_FUNCTION */
-PHP_RSHUTDOWN_FUNCTION(sockets)
+static PHP_RSHUTDOWN_FUNCTION(sockets)
 {
        if (SOCKETS_G(strerror_buf)) {
                efree(SOCKETS_G(strerror_buf));
                SOCKETS_G(strerror_buf) = NULL;
        }
-       php_socket_sendrecvmsg_shutdown(SHUTDOWN_FUNC_ARGS_PASSTHRU);
 
        return SUCCESS;
 }


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

Reply via email to