summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2003-10-07 15:47:25 +0000
committerZeev Suraski <zeev@php.net>2003-10-07 15:47:25 +0000
commit2cc9511cc703cf617fcf7fa9ca3afb174cd86681 (patch)
treef918707eb3a55fb50bebf9f6d941f23c3c64653e
parentd16d25b136977d1453c0eb42b50c9a6ec1fb39bc (diff)
downloadphp-git-2cc9511cc703cf617fcf7fa9ca3afb174cd86681.tar.gz
Fix cast callbacks
-rw-r--r--ext/com_dotnet/com_handlers.c7
-rw-r--r--ext/simplexml/simplexml.c11
2 files changed, 12 insertions, 6 deletions
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index 0b759ecc0e..7a51777023 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -445,7 +445,7 @@ static int com_objects_compare(zval *object1, zval *object2 TSRMLS_DC)
return ret;
}
-static void com_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
+static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
{
php_com_dotnet_object *obj;
VARIANT v;
@@ -463,12 +463,12 @@ static void com_object_cast(zval *readobj, zval *writeobj, int type, int should_
if (V_VT(&obj->v) == VT_DISPATCH) {
if (!obj->have_default_bind && !com_get_default_binding(obj TSRMLS_CC)) {
- return;
+ return FAILURE;
}
if (FAILURE == php_com_do_invoke_by_id(obj, obj->default_bind,
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC)) {
- return;
+ return FAILURE;
}
} else {
VariantCopy(&v, &obj->v);
@@ -495,6 +495,7 @@ static void com_object_cast(zval *readobj, zval *writeobj, int type, int should_
php_com_zval_from_variant(writeobj, &v, obj->code_page TSRMLS_CC);
VariantClear(&v);
+ return SUCCESS;
}
zend_object_handlers php_com_object_handlers = {
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 7316ad9ebc..da3968f753 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -724,7 +724,7 @@ sxe_class_name_get(zval *object, char **class_name, zend_uint *class_name_len, i
/* {{{ cast_object()
*/
-static void
+static int
cast_object(zval *object, int type, char *contents TSRMLS_DC)
{
if (contents) {
@@ -744,18 +744,22 @@ cast_object(zval *object, int type, char *contents TSRMLS_DC)
case IS_DOUBLE:
convert_to_double(object);
break;
+ default:
+ return FAILURE;
}
+ return SUCCESS;
}
/* }}} */
/* {{{ sxe_object_cast()
*/
-static void
+static int
sxe_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
{
php_sxe_object *sxe;
char *contents = NULL;
zval free_obj;
+ int rv;
sxe = php_sxe_fetch_object(readobj TSRMLS_CC);
if (should_free) {
@@ -774,7 +778,7 @@ sxe_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_
}
}
- cast_object(writeobj, type, contents TSRMLS_CC);
+ rv = cast_object(writeobj, type, contents TSRMLS_CC);
if (contents) {
xmlFree(contents);
@@ -782,6 +786,7 @@ sxe_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_
if (should_free) {
zval_dtor(&free_obj);
}
+ return rv;
}
/* }}} */