com php-src: backported the fix for bug #41577: ext/com_dotne t/com_dotnet.c

From: Date: Tue, 12 Aug 2014 09:49:46 +0000
Subject: com php-src: backported the fix for bug #41577: ext/com_dotne t/com_dotnet.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-79817@lists.php.net to get a copy of this message
Commit: daa1fb8ba68924288216c68eec5bd0d1f8ffd98c Author: Anatol Belski <ab@php.net> Tue, 12 Aug 2014 11:49:46 +0200 Parents: 39dd715382b6b2e0c19ff8edac7a185ded3721c9 Branches: PHP-5.4 PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=daa1fb8ba68924288216c68eec5bd0d1f8ffd98c Log: backported the fix for bug #41577 Bugs: https://bugs.php.net/41577 Changed paths: M ext/com_dotnet/com_dotnet.c Diff: diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index 0aa1a2a..073f40f 100644 --- a/ext/com_dotnet/com_dotnet.c +++ b/ext/com_dotnet/com_dotnet.c @@ -198,7 +198,8 @@ PHP_FUNCTION(com_dotnet_create_instance) IUnknown *unk = NULL; php_com_initialize(TSRMLS_C); - if (COMG(dotnet_runtime_stuff) == NULL) { + stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff); + if (stuff == NULL) { hr = dotnet_init(&where TSRMLS_CC); if (FAILED(hr)) { char buf[1024]; @@ -210,9 +211,35 @@ PHP_FUNCTION(com_dotnet_create_instance) ZVAL_NULL(object); return; } - } + stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff); - stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff); + } else if (stuff->dotnet_domain == NULL) { + where = "ICorRuntimeHost_GetDefaultDomain"; + hr = ICorRuntimeHost_GetDefaultDomain(stuff->dotnet_host, &unk); + if (FAILED(hr)) { + char buf[1024]; + char *err = php_win32_error_to_msg(hr); + snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err); + if (err) + LocalFree(err); + php_com_throw_exception(hr, buf TSRMLS_CC); + ZVAL_NULL(object); + return; + } + + where = "QI: System._AppDomain"; + hr = IUnknown_QueryInterface(unk, &IID_mscorlib_System_AppDomain, (LPVOID*)&stuff->dotnet_domain); + if (FAILED(hr)) { + char buf[1024]; + char *err = php_win32_error_to_msg(hr); + snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err); + if (err) + LocalFree(err); + php_com_throw_exception(hr, buf TSRMLS_CC); + ZVAL_NULL(object); + return; + } + } obj = CDNO_FETCH(object);

« previous php.cvs (#79817) next »