summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_handlers.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2004-04-28 08:23:22 +0000
committerWez Furlong <wez@php.net>2004-04-28 08:23:22 +0000
commit027d45016653db83d1d61a94cba885b3d5e08304 (patch)
treeef6a6fabfc9a0391855ce751e1f85ef1943a0fea /ext/com_dotnet/com_handlers.c
parentb97ecc182092e2f6893a69e8a5c621532394ca2c (diff)
downloadphp-git-027d45016653db83d1d61a94cba885b3d5e08304.tar.gz
Fix for Bug #28161 (and probably others that I can't find in the bug db;
the search interface sucks). Expand the proxy object so it can handle psuedo array style properties. ASP/VB code like this: headObj.Attribute("RID") = rid can be expressed like this in PHP: $headObj->Attribute['RID'] = $rid; In theory, this feature can be used for "multi dimensional" properties: headObj.Attribute("RID", "Foo") = rid; like this: $headObj->Attribute['RID']['Foo'] = $rid;
Diffstat (limited to 'ext/com_dotnet/com_handlers.c')
-rw-r--r--ext/com_dotnet/com_handlers.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index 4b39a47197..071f9df5f3 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -34,6 +34,7 @@ static zval *com_property_read(zval *object, zval *member, int type TSRMLS_DC)
zval *return_value;
php_com_dotnet_object *obj;
VARIANT v;
+ HRESULT res;
MAKE_STD_ZVAL(return_value);
ZVAL_NULL(return_value);
@@ -46,10 +47,15 @@ static zval *com_property_read(zval *object, zval *member, int type TSRMLS_DC)
VariantInit(&v);
convert_to_string_ex(&member);
- if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
- DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC)) {
+
+ res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
+ DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC);
+
+ if (res == SUCCESS) {
php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC);
VariantClear(&v);
+ } else if (res == DISP_E_BADPARAMCOUNT) {
+ php_com_saproxy_create(object, return_value, member TSRMLS_CC);
}
} else {
php_com_throw_exception(E_INVALIDARG, "this variant has no properties" TSRMLS_CC);
@@ -137,7 +143,7 @@ static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
VariantClear(&v);
}
} else {
- php_com_saproxy_create(object, return_value, Z_LVAL_P(offset) TSRMLS_CC);
+ php_com_saproxy_create(object, return_value, offset TSRMLS_CC);
}
} else {
@@ -555,7 +561,6 @@ void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable TSR
void php_com_object_free_storage(void *object TSRMLS_DC)
{
php_com_dotnet_object *obj = (php_com_dotnet_object*)object;
-
if (obj->typeinfo) {
ITypeInfo_Release(obj->typeinfo);
obj->typeinfo = NULL;
@@ -614,7 +619,6 @@ zend_object_value php_com_object_new(zend_class_entry *ce TSRMLS_DC)
obj->code_page = CP_ACP;
obj->ce = ce;
-
retval.handle = zend_objects_store_put(obj, NULL, php_com_object_free_storage, php_com_object_clone TSRMLS_CC);
retval.handlers = &php_com_object_handlers;