com php-src: improve fix for bug #73679 with new capabilities available: ext/com_dotnet/com_dotnet.c
| From: | Anatol Belski | Date: | Sun, 11 Dec 2016 16:25:48 +0000 |
| Subject: | com php-src: improve fix for bug #73679 with new capabilities available: ext/com_dotnet/com_dotnet.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96292@lists.php.net to get a copy of this message | ||
Commit: e6e5f06c78864d74279c04730ecab5708663c7c8
Author: Anatol Belski <ab@php.net> Sun, 11 Dec 2016 17:25:48 +0100
Parents: fb92116a5a0194d4664a9284b21be3f1cc015cd5
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e6e5f06c78864d74279c04730ecab5708663c7c8
Log:
improve fix for bug #73679 with new capabilities available
Bugs:
https://bugs.php.net/73679
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 a6b75ca..58002bb 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -197,6 +197,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
char *where = "";
IUnknown *unk = NULL;
zend_long cp = CP_ACP;
+ const struct php_win32_cp *cp_it;
php_com_initialize();
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
@@ -251,11 +252,12 @@ PHP_FUNCTION(com_dotnet_create_instance)
return;
}
- if (Z_L(0) > cp || ZEND_LONG_INT_OVFL(cp)) {
+ cp_it = php_win32_cp_get_by_id((DWORD)cp);
+ if (!cp_it) {
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid
codepage!");
return;
}
- obj->code_page = (int)cp;
+ obj->code_page = (int)cp_it->id;
oletype = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page);
oleassembly = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page);