diff options
author | Anatol Belski <ab@php.net> | 2014-08-12 11:50:55 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-08-12 11:50:55 +0200 |
commit | 934c35f58685cde2e0bc7e649486db7b488758e9 (patch) | |
tree | add18eb88a5f46ae2c5a2744970db13b70b41ac6 /ext/com_dotnet | |
parent | 7aa776c7b46b5913564d9599988bd41ff2ddc05c (diff) | |
parent | 8c247af1fc0407880e806e670607bac575472e7c (diff) | |
download | php-git-934c35f58685cde2e0bc7e649486db7b488758e9.tar.gz |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
updated NEWS
backported the fix for bug #41577
Diffstat (limited to 'ext/com_dotnet')
-rw-r--r-- | ext/com_dotnet/com_dotnet.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index 0aa1a2a9c7..073f40f83a 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); |