summaryrefslogtreecommitdiff
path: root/ext/com_dotnet
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2005-04-18 16:38:31 +0000
committerWez Furlong <wez@php.net>2005-04-18 16:38:31 +0000
commit195f69f0c76fe46fe181a053d1eb8467a8a6cb02 (patch)
tree721784d69a3cb23f1a755cfe1c89ee90066b59af /ext/com_dotnet
parentea6d23b8c07464ed514d1556e6c43fc1709799dd (diff)
downloadphp-git-195f69f0c76fe46fe181a053d1eb8467a8a6cb02.tar.gz
merge bug fixes from branch
Diffstat (limited to 'ext/com_dotnet')
-rw-r--r--ext/com_dotnet/com_handlers.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index dde8513ce7..8f628c03b6 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -525,14 +525,15 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f
php_com_dotnet_object *obj;
VARIANT v;
VARTYPE vt = VT_EMPTY;
+ zval free_obj;
+ HRESULT res = S_OK;
if (should_free) {
- zval_dtor(writeobj);
+ free_obj = *writeobj;
}
- ZVAL_NULL(writeobj);
-
obj = CDNO_FETCH(readobj);
+ ZVAL_NULL(writeobj);
VariantInit(&v);
if (V_VT(&obj->v) == VT_DISPATCH) {
@@ -566,12 +567,24 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f
}
if (vt != VT_EMPTY && vt != V_VT(&v)) {
- VariantChangeType(&v, &v, 0, vt);
+ res = VariantChangeType(&v, &v, 0, vt);
+ }
+
+ if (SUCCEEDED(res)) {
+ php_com_zval_from_variant(writeobj, &v, obj->code_page TSRMLS_CC);
}
- php_com_zval_from_variant(writeobj, &v, obj->code_page TSRMLS_CC);
VariantClear(&v);
- return SUCCESS;
+
+ if (should_free) {
+ zval_dtor(&free_obj);
+ }
+
+ if (SUCCEEDED(res)) {
+ return SUCCESS;
+ }
+
+ return FAILURE;
}
static int com_object_count(zval *object, long *count TSRMLS_DC)