summaryrefslogtreecommitdiff
path: root/ext/com_dotnet
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2006-01-26 11:17:34 +0000
committerRob Richards <rrichards@php.net>2006-01-26 11:17:34 +0000
commitc53b926a35cab9cf385de212c7c7d48bc512b013 (patch)
treebcb56aa3077a32b1f3d96a9d3a74c3794b7caeff /ext/com_dotnet
parentcb4bb6e3898e04c7ec0733f4a0a5d66b2532188f (diff)
downloadphp-git-c53b926a35cab9cf385de212c7c7d48bc512b013.tar.gz
Fix bug #35954 (Fatal com_exception casting object)
Diffstat (limited to 'ext/com_dotnet')
-rw-r--r--ext/com_dotnet/com_com.c12
-rw-r--r--ext/com_dotnet/com_handlers.c8
-rw-r--r--ext/com_dotnet/php_com_dotnet_internal.h4
3 files changed, 12 insertions, 12 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c
index bb9e030a07..e8dd8d2e6f 100644
--- a/ext/com_dotnet/com_com.c
+++ b/ext/com_dotnet/com_com.c
@@ -336,7 +336,7 @@ PHP_FUNCTION(com_get_active_object)
/* Performs an Invoke on the given com object.
* returns a failure code and creates an exception if there was an error */
HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
- WORD flags, DISPPARAMS *disp_params, VARIANT *v TSRMLS_DC)
+ WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent TSRMLS_DC)
{
HRESULT hr;
unsigned int arg_err;
@@ -345,7 +345,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
hr = IDispatch_Invoke(V_DISPATCH(&obj->v), id_member,
&IID_NULL, LOCALE_SYSTEM_DEFAULT, flags, disp_params, v, &e, &arg_err);
- if (FAILED(hr)) {
+ if (silent == 0 && FAILED(hr)) {
char *source = NULL, *desc = NULL, *msg = NULL;
int source_len, desc_len;
@@ -543,7 +543,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
}
/* this will create an exception if needed */
- hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v TSRMLS_CC);
+ hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, 0 TSRMLS_CC);
/* release variants */
if (vargs) {
@@ -581,7 +581,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
- WORD flags, VARIANT *v, int nargs, zval **args TSRMLS_DC)
+ WORD flags, VARIANT *v, int nargs, zval **args, int silent TSRMLS_DC)
{
DISPID altdispid;
DISPPARAMS disp_params;
@@ -610,7 +610,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
}
/* this will create an exception if needed */
- hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v TSRMLS_CC);
+ hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, silent TSRMLS_CC);
/* release variants */
if (vargs) {
@@ -646,7 +646,7 @@ int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
return FAILURE;
}
- return php_com_do_invoke_by_id(obj, dispid, flags, v, nargs, args TSRMLS_CC);
+ return php_com_do_invoke_by_id(obj, dispid, flags, v, nargs, args, 0 TSRMLS_CC);
}
/* {{{ proto string com_create_guid()
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index 7ecc90e4c7..0fb3787c88 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -101,7 +101,7 @@ static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
VariantInit(&v);
if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE,
- DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 1, &offset TSRMLS_CC)) {
+ DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 1, &offset, 0 TSRMLS_CC)) {
php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC);
VariantClear(&v);
}
@@ -140,7 +140,7 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
VariantInit(&v);
if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE,
- DISPATCH_METHOD|DISPATCH_PROPERTYPUT, &v, 2, args TSRMLS_CC)) {
+ DISPATCH_METHOD|DISPATCH_PROPERTYPUT, &v, 2, args, 0 TSRMLS_CC)) {
VariantClear(&v);
}
} else if (V_ISARRAY(&obj->v)) {
@@ -504,8 +504,8 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f
if (V_VT(&obj->v) == VT_DISPATCH) {
if (FAILURE == php_com_do_invoke_by_id(obj, DISPID_VALUE,
- DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC)) {
- return FAILURE;
+ DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC)) {
+ VariantCopy(&v, &obj->v);
}
} else {
VariantCopy(&v, &obj->v);
diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h
index 6b46f5f439..4c442389f6 100644
--- a/ext/com_dotnet/php_com_dotnet_internal.h
+++ b/ext/com_dotnet/php_com_dotnet_internal.h
@@ -102,11 +102,11 @@ PHP_FUNCTION(com_load_typelib);
PHP_FUNCTION(com_get_active_object);
HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
- WORD flags, DISPPARAMS *disp_params, VARIANT *v TSRMLS_DC);
+ WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent TSRMLS_DC);
HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
int namelen, DISPID *dispid TSRMLS_DC);
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
- WORD flags, VARIANT *v, int nargs, zval **args TSRMLS_DC);
+ WORD flags, VARIANT *v, int nargs, zval **args, int silent TSRMLS_DC);
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
WORD flags, VARIANT *v, int nargs, zval **args TSRMLS_DC);
int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,