summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandy wharmby <wharmby@php.net>2007-03-05 15:49:00 +0000
committerandy wharmby <wharmby@php.net>2007-03-05 15:49:00 +0000
commita252c79d53fdaf3d3739d3ee395986c03dfa6893 (patch)
tree94e757261d29a02e642b6928a0f21dc94930c70e
parentc938da6a97a6cd2eb0d71397ca762a3e4014bf89 (diff)
downloadphp-git-a252c79d53fdaf3d3739d3ee395986c03dfa6893.tar.gz
Fixed bug #35872 (Prevent object store references during RSHUTDOWN)
-rw-r--r--NEWS2
-rw-r--r--ext/com_dotnet/com_extension.c2
-rw-r--r--ext/com_dotnet/com_wrapper.c29
-rw-r--r--ext/com_dotnet/php_com_dotnet.h1
4 files changed, 23 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index bdeac78967..1d64a2ae0a 100644
--- a/NEWS
+++ b/NEWS
@@ -68,6 +68,7 @@ PHP NEWS
- 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 @@ PHP NEWS
- 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)
-
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index bc76f1bbd7..5150013105 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.c
@@ -315,6 +315,7 @@ PHP_MSHUTDOWN_FUNCTION(com_dotnet)
*/
PHP_RINIT_FUNCTION(com_dotnet)
{
+ COMG(rshutdown_started) = 0;
return SUCCESS;
}
/* }}} */
@@ -328,6 +329,7 @@ PHP_RSHUTDOWN_FUNCTION(com_dotnet)
php_com_dotnet_rshutdown(TSRMLS_C);
}
#endif
+ COMG(rshutdown_started) = 1;
return SUCCESS;
}
/* }}} */
diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c
index b698affa22..0dfc9247fa 100644
--- a/ext/com_dotnet/com_wrapper.c
+++ b/ext/com_dotnet/com_wrapper.c
@@ -92,13 +92,17 @@ static inline void trace(char *fmt, ...)
# 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 @@ static php_dispatchex *disp_constructor(zval *object TSRMLS_DC)
{
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 @@ static void disp_destructor(php_dispatchex *disp)
{
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)
diff --git a/ext/com_dotnet/php_com_dotnet.h b/ext/com_dotnet/php_com_dotnet.h
index 2358772999..e64e357ee4 100644
--- a/ext/com_dotnet/php_com_dotnet.h
+++ b/ext/com_dotnet/php_com_dotnet.h
@@ -47,6 +47,7 @@ ZEND_BEGIN_MODULE_GLOBALS(com_dotnet)
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