diff options
-rw-r--r-- | ext/com_dotnet/com_com.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 86b3bd1dd5..68252daab0 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -53,6 +53,7 @@ PHP_FUNCTION(com_create_instance) &authid, EOAC_NONE }; zend_long cp = CP_ACP; + const struct php_win32_cp *cp_it; php_com_initialize(); obj = CDNO_FETCH(object); @@ -70,7 +71,8 @@ PHP_FUNCTION(com_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 COM object - invalid codepage!"); return; } |