summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_dotnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/com_dotnet/com_dotnet.c')
-rw-r--r--ext/com_dotnet/com_dotnet.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index 195ba63916..72e4ffc28b 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 = GetACP();
+ 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);