return SUCCESS;
}
+static int com_object_count(zval *object, long *count TSRMLS_DC)
+{
+ php_com_dotnet_object *obj;
+ LONG ubound = 0, lbound = 0;
+
+ obj = CDNO_FETCH(object);
+
+ if (!V_ISARRAY(&obj->v)) {
+ return FAILURE;
+ }
+
+ SafeArrayGetLBound(V_ARRAY(&obj->v), 1, &lbound);
+ SafeArrayGetUBound(V_ARRAY(&obj->v), 1, &ubound);
+
+ *count = ubound - lbound + 1;
+
+ return SUCCESS;
+}
+
zend_object_handlers php_com_object_handlers = {
ZEND_OBJECTS_STORE_HANDLERS,
com_property_read,
com_class_entry_get,
com_class_name_get,
com_objects_compare,
- com_object_cast
+ com_object_cast,
+ com_object_count
};
void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable TSRMLS_DC)
return FAILURE;
}
+static int saproxy_count_elements(zval *object, long *count TSRMLS_DC)
+{
+ php_com_saproxy *proxy = SA_FETCH(object);
+ LONG ubound, lbound;
+
+ if (!V_ISARRAY(&proxy->obj->v)) {
+ return FAILURE;
+ }
+
+ SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &lbound);
+ SafeArrayGetUBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &ubound);
+
+ *count = ubound - lbound + 1;
+
+ return SUCCESS;
+}
+
zend_object_handlers php_com_saproxy_handlers = {
ZEND_OBJECTS_STORE_HANDLERS,
saproxy_property_read,
saproxy_class_entry_get,
saproxy_class_name_get,
saproxy_objects_compare,
- saproxy_object_cast
+ saproxy_object_cast,
+ saproxy_count_elements
};
static void saproxy_free_storage(void *object TSRMLS_DC)
NULL, /* zend_get_std_object_handlers()->get_class_entry,*/
NULL, /* zend_get_std_object_handlers()->get_class_name,*/
sxe_objects_compare,
- sxe_object_cast
+ sxe_object_cast,
+ NULL
};
/* {{{ sxe_object_clone()
case IS_ARRAY:
RETURN_LONG (php_count_recursive (array, mode TSRMLS_CC));
break;
+ case IS_OBJECT:
+ if (Z_OBJ_HT(*array)->count_elements) {
+ RETVAL_LONG(1);
+ if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value) TSRMLS_CC)) {
+ return;
+ }
+ }
default:
RETURN_LONG(1);
break;