summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_com.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/com_dotnet/com_com.c')
-rw-r--r--ext/com_dotnet/com_com.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c
index 58a22a9c62..768e3a1169 100644
--- a/ext/com_dotnet/com_com.c
+++ b/ext/com_dotnet/com_com.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -28,7 +26,7 @@
#include "Zend/zend_exceptions.h"
/* {{{ com_create_instance - ctor for COM class */
-PHP_FUNCTION(com_create_instance)
+PHP_METHOD(com, __construct)
{
zval *object = getThis();
zval *server_params = NULL;
@@ -53,26 +51,24 @@ PHP_FUNCTION(com_create_instance)
zend_long cp = GetACP();
const struct php_win32_cp *cp_it;
- php_com_initialize();
- obj = CDNO_FETCH(object);
-
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
ZEND_NUM_ARGS(), "s|s!ls",
&module_name, &module_name_len, &server_name, &server_name_len,
&cp, &typelib_name, &typelib_name_len) &&
- FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
+ FAILURE == zend_parse_parameters(
ZEND_NUM_ARGS(), "sa|ls",
&module_name, &module_name_len, &server_params, &cp,
&typelib_name, &typelib_name_len)) {
-
- php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid arguments!");
- return;
+ RETURN_THROWS();
}
+ php_com_initialize();
+ obj = CDNO_FETCH(object);
+
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;
+ RETURN_THROWS();
}
obj->code_page = (int)cp;
@@ -120,7 +116,7 @@ PHP_FUNCTION(com_create_instance)
if (server_name && !COMG(allow_dcom)) {
php_com_throw_exception(E_ERROR, "DCOM has been disabled by your administrator [com.allow_dcom=0]");
- return;
+ RETURN_THROWS();
}
moniker = php_com_string_to_olestring(module_name, module_name_len, obj->code_page);
@@ -235,7 +231,7 @@ PHP_FUNCTION(com_create_instance)
php_com_throw_exception(res, msg);
efree(msg);
- return;
+ RETURN_THROWS();
}
/* we got the object and it lives ! */
@@ -302,8 +298,7 @@ PHP_FUNCTION(com_get_active_object)
php_com_initialize();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
&module_name, &module_name_len, &code_page)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments!");
- return;
+ RETURN_THROWS();
}
module = php_com_string_to_olestring(module_name, module_name_len, (int)code_page);
@@ -501,7 +496,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
if (f->arg_info) {
for (i = 0; i < nargs; i++) {
- if (f->arg_info[nargs - i - 1].pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(&f->arg_info[nargs - i - 1])) {
byref_count++;
}
}
@@ -510,7 +505,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
if (byref_count) {
byref_vals = (VARIANT*)safe_emalloc(sizeof(VARIANT), byref_count, 0);
for (j = 0, i = 0; i < nargs; i++) {
- if (f->arg_info[nargs - i - 1].pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(&f->arg_info[nargs - i - 1])) {
/* put the value into byref_vals instead */
php_com_variant_from_zval(&byref_vals[j], &args[nargs - i - 1], obj->code_page);
@@ -557,7 +552,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
if (f && f->arg_info) {
for (i = 0, j = 0; i < nargs; i++) {
/* if this was byref, update the zval */
- if (f->arg_info[nargs - i - 1].pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(&f->arg_info[nargs - i - 1])) {
zval *arg = &args[nargs - i - 1];
ZVAL_DEREF(arg);
@@ -671,7 +666,7 @@ PHP_FUNCTION(com_create_guid)
OLECHAR *guid_string;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_com_initialize();
@@ -704,7 +699,7 @@ PHP_FUNCTION(com_event_sink)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Oo|z/",
&object, php_com_variant_class_entry, &sinkobject, &sink)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_com_initialize();
@@ -765,7 +760,7 @@ PHP_FUNCTION(com_print_typeinfo)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z/|s!b", &arg1, &ifacename,
&ifacelen, &wantsink)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_com_initialize();
@@ -797,7 +792,7 @@ PHP_FUNCTION(com_message_pump)
DWORD result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &timeoutms) == FAILURE)
- RETURN_FALSE;
+ RETURN_THROWS();
php_com_initialize();
result = MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeoutms, QS_ALLINPUT);
@@ -828,11 +823,12 @@ PHP_FUNCTION(com_load_typelib)
int cached = 0;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &name, &namelen, &cs)) {
- return;
+ RETURN_THROWS();
}
if (!cs) {
- php_error_docref(NULL, E_DEPRECATED, "Declaration of case-insensitive constants is deprecated");
+ php_error_docref(NULL, E_WARNING, "Declaration of case-insensitive constants is no longer supported");
+ RETURN_FALSE;
}
RETVAL_FALSE;