summaryrefslogtreecommitdiff
path: root/ext/dom/php_dom.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r--ext/dom/php_dom.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 8a00ad5a08..71c06612db 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -619,6 +619,8 @@ PHP_MINIT_FUNCTION(dom)
memcpy(&dom_nnodemap_object_handlers, &dom_object_handlers, sizeof(zend_object_handlers));
dom_nnodemap_object_handlers.free_obj = dom_nnodemap_objects_free_storage;
dom_nnodemap_object_handlers.dtor_obj = dom_nnodemap_object_dtor;
+ dom_nnodemap_object_handlers.read_dimension = dom_nodelist_read_dimension;
+ dom_nnodemap_object_handlers.has_dimension = dom_nodelist_has_dimension;
zend_hash_init(&classes, 0, NULL, NULL, 1);
@@ -1542,6 +1544,41 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
}
/* }}} end dom_get_nsdecl */
+zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv TSRMLS_DC) /* {{{ */
+{
+ zval offset_copy;
+
+ if (!offset) {
+ return NULL;
+ }
+
+ ZVAL_COPY(&offset_copy, offset);
+ convert_to_long(&offset_copy);
+
+ zend_call_method_with_1_params(object, Z_OBJCE_P(object), NULL, "item", rv, &offset_copy);
+
+ return rv;
+} /* }}} end dom_nodelist_read_dimension */
+
+int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty TSRMLS_DC)
+{
+ zval *length, offset_copy;
+ int ret;
+
+ ZVAL_COPY(&offset_copy, member);
+ convert_to_long(&offset_copy);
+
+ if (Z_LVAL(offset_copy) < 0) {
+ return 0;
+ }
+
+ length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0 TSRMLS_CC);
+
+ ret = Z_LVAL(offset_copy) < Z_LVAL_P(length);
+
+ return ret;
+} /* }}} end dom_nodelist_has_dimension */
+
#endif /* HAVE_DOM */
/*