Skip to content

Commit e6e5f06

Browse files
committed
improve fix for bug #73679 with new capabilities available
1 parent fb92116 commit e6e5f06

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/com_dotnet/com_dotnet.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
197197
char *where = "";
198198
IUnknown *unk = NULL;
199199
zend_long cp = CP_ACP;
200+
const struct php_win32_cp *cp_it;
200201

201202
php_com_initialize();
202203
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
@@ -251,11 +252,12 @@ PHP_FUNCTION(com_dotnet_create_instance)
251252
return;
252253
}
253254

254-
if (Z_L(0) > cp || ZEND_LONG_INT_OVFL(cp)) {
255+
cp_it = php_win32_cp_get_by_id((DWORD)cp);
256+
if (!cp_it) {
255257
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid codepage!");
256258
return;
257259
}
258-
obj->code_page = (int)cp;
260+
obj->code_page = (int)cp_it->id;
259261

260262
oletype = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page);
261263
oleassembly = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page);

0 commit comments

Comments
 (0)