wharmby         Mon Mar  5 15:49:00 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/com_dotnet     com_wrapper.c com_extension.c 
                                php_com_dotnet.h 
    /php-src    NEWS 
  Log:
  Fixed bug #35872 (Prevent object store references during RSHUTDOWN)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_wrapper.c?r1=1.9.2.1.2.4&r2=1.9.2.1.2.5&diff_format=u
Index: php-src/ext/com_dotnet/com_wrapper.c
diff -u php-src/ext/com_dotnet/com_wrapper.c:1.9.2.1.2.4 
php-src/ext/com_dotnet/com_wrapper.c:1.9.2.1.2.5
--- php-src/ext/com_dotnet/com_wrapper.c:1.9.2.1.2.4    Sat Feb 24 02:17:24 2007
+++ php-src/ext/com_dotnet/com_wrapper.c        Mon Mar  5 15:49:00 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_wrapper.c,v 1.9.2.1.2.4 2007/02/24 02:17:24 helly Exp $ */
+/* $Id: com_wrapper.c,v 1.9.2.1.2.5 2007/03/05 15:49:00 wharmby Exp $ */
 
 /* This module exports a PHP object as a COM object by wrapping it
  * using IDispatchEx */
@@ -92,13 +92,17 @@
 # define TSRMLS_FIXED()
 #endif
 
-#define FETCH_DISP(methname)   \
-       TSRMLS_FIXED() \
-       php_dispatchex *disp = (php_dispatchex*)This; \
-       trace(" PHP:%s %s\n", Z_OBJCE_P(disp->object)->name, methname); \
-       if (GetCurrentThreadId() != disp->engine_thread) \
-               return RPC_E_WRONG_THREAD;
-
+#define FETCH_DISP(methname)                                                   
                                                                                
                \
+       TSRMLS_FIXED()                                                          
                                                                                
                                \
+       php_dispatchex *disp = (php_dispatchex*)This;                           
                                                                                
\
+       if (COMG(rshutdown_started)) {                                          
                                                                                
                \
+               trace(" PHP Object:%p (name:unknown) %s\n", disp->object,  
methname);                                                   \
+       } else {                                                                
                                                                                
                                        \
+               trace(" PHP Object:%p (name:%s) %s\n", disp->object, 
Z_OBJCE_P(disp->object)->name, methname);  \
+       }                                                                       
                                                                                
                                                \
+       if (GetCurrentThreadId() != disp->engine_thread) {                      
                                                                                
\
+               return RPC_E_WRONG_THREAD;                                      
                                                                                
                        \
+       }
 
 static HRESULT STDMETHODCALLTYPE disp_queryinterface( 
        IDispatchEx *This,
@@ -534,7 +538,7 @@
 {
        php_dispatchex *disp = 
(php_dispatchex*)CoTaskMemAlloc(sizeof(php_dispatchex));
 
-       trace("constructing a COM proxy\n");
+       trace("constructing a COM wrapper for PHP object %p (%s)\n", object, 
Z_OBJCE_P(object)->name);
        
        if (disp == NULL)
                return NULL;
@@ -559,8 +563,13 @@
 {
        TSRMLS_FETCH();
        
-       trace("destroying COM wrapper for PHP object %s\n", 
Z_OBJCE_P(disp->object)->name);
-
+       /* Object store not available during request shutdown */
+       if (COMG(rshutdown_started)) {
+               trace("destroying COM wrapper for PHP object %p 
(name:unknown)\n", disp->object);
+       } else {
+               trace("destroying COM wrapper for PHP object %p (name:%s)\n", 
disp->object, Z_OBJCE_P(disp->object)->name);
+       }
+       
        disp->id = 0;
        
        if (disp->refcount > 0)
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_extension.c?r1=1.17.2.2.2.5&r2=1.17.2.2.2.6&diff_format=u
Index: php-src/ext/com_dotnet/com_extension.c
diff -u php-src/ext/com_dotnet/com_extension.c:1.17.2.2.2.5 
php-src/ext/com_dotnet/com_extension.c:1.17.2.2.2.6
--- php-src/ext/com_dotnet/com_extension.c:1.17.2.2.2.5 Mon Jan  1 09:35:48 2007
+++ php-src/ext/com_dotnet/com_extension.c      Mon Mar  5 15:49:00 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_extension.c,v 1.17.2.2.2.5 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: com_extension.c,v 1.17.2.2.2.6 2007/03/05 15:49:00 wharmby Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -315,6 +315,7 @@
  */
 PHP_RINIT_FUNCTION(com_dotnet)
 {
+       COMG(rshutdown_started) = 0;
        return SUCCESS;
 }
 /* }}} */
@@ -328,6 +329,7 @@
                php_com_dotnet_rshutdown(TSRMLS_C);
        }
 #endif
+       COMG(rshutdown_started) = 1;
        return SUCCESS;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/php_com_dotnet.h?r1=1.5.2.1.2.1&r2=1.5.2.1.2.2&diff_format=u
Index: php-src/ext/com_dotnet/php_com_dotnet.h
diff -u php-src/ext/com_dotnet/php_com_dotnet.h:1.5.2.1.2.1 
php-src/ext/com_dotnet/php_com_dotnet.h:1.5.2.1.2.2
--- php-src/ext/com_dotnet/php_com_dotnet.h:1.5.2.1.2.1 Mon Jan  1 09:35:48 2007
+++ php-src/ext/com_dotnet/php_com_dotnet.h     Mon Mar  5 15:49:00 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_com_dotnet.h,v 1.5.2.1.2.1 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: php_com_dotnet.h,v 1.5.2.1.2.2 2007/03/05 15:49:00 wharmby Exp $ */
 
 #ifndef PHP_COM_DOTNET_H
 #define PHP_COM_DOTNET_H
@@ -47,6 +47,7 @@
        zend_bool autoreg_case_sensitive;
        void *dotnet_runtime_stuff; /* opaque to avoid cluttering up other 
modules */
        int code_page; /* default code_page if left unspecified */
+       zend_bool rshutdown_started;
 ZEND_END_MODULE_GLOBALS(com_dotnet)
 
 #ifdef ZTS
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.573&r2=1.2027.2.547.2.574&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.573 php-src/NEWS:1.2027.2.547.2.574
--- php-src/NEWS:1.2027.2.547.2.573     Mon Mar  5 14:10:27 2007
+++ php-src/NEWS        Mon Mar  5 15:49:00 2007
@@ -68,6 +68,7 @@
 - Fixed bug #38406 (crash when assigning objects to SimpleXML attributes). 
(Tony)
 - Fixed bug #37799 (ftp_ssl_connect() falls back to non-ssl connection). (Nuno)
 - Fixed bug #36496 (SSL support in imap_open() not working on Windows). (Edin)
+- Fixed bug #35872 (Avoid crash caused by object store being referenced during 
RSHUTDOWN) (Andy) 
 - Fixed bug #34794 (proc_close() hangs when used with two processes).
   (jdolecek at netbsd dot org, Nuno)
 - Limit nesting level of input variables with max_input_nesting_level 
@@ -2532,4 +2533,3 @@
 - Fixed bug #28694 (ReflectionExtension::getFunctions() crashes PHP). (Marcus)
 - Fixed bug #28512 (Allocate enough space to store MSSQL data). (Frank)
 - Fixed strip_tags() to correctly handle '\0' characters. (Stefan)
-

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

Reply via email to