Fixed bug #35872 (Prevent object store references during RSHUTDOWN)

This commit is contained in:
andy wharmby 2007-03-05 15:49:00 +00:00
parent c938da6a97
commit a252c79d53
4 changed files with 23 additions and 11 deletions

2
NEWS
View file

@ -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)

View file

@ -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;
}
/* }}} */

View file

@ -95,10 +95,14 @@ static inline void trace(char *fmt, ...)
#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;
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,7 +563,12 @@ 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;

View file

@ -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