diff options
author | Anatol Belski <ab@php.net> | 2014-10-10 22:51:13 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-10-10 22:51:13 +0200 |
commit | e1cd0e0a38deb91d24ded68df010b7f6c03d2cb6 (patch) | |
tree | 19090152884f17ee4d7691ee79462f4a0537d356 /ext/dom/php_dom.c | |
parent | fe42847799c9fab9476ca6399e25ed0da0cb2d5c (diff) | |
parent | e33e4b2d8c44fb04afc54f688ed44dce7e8a2e0f (diff) | |
download | php-git-e1cd0e0a38deb91d24ded68df010b7f6c03d2cb6.tar.gz |
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (40 commits)
int to size_t where the underlaying API supports it
use php_socket_t instead of int
fix signed/unsigned mismatch warning
fix compilation warning
Improved specialisation $this variable accessed through IS_UNUSED operand must be IS_OBJECT, so we don't have to check for its type or perform dereference.
Add notes about get_class_entry/get_class_name to UPGRADING
Fix casts in GD
Drop redundant casting code from ext/filter
update NEWS
update NEWS
update NEWS
update NEWS
Added note to UPGRADING regarding 64-bit support in pack()/unpack()
pack(): Use SIZEOF_ZEND_LONG instead of SIZEOF_LONG
Add 64 bit formats to pack() and unpack()
Help to CPU branch predictor
Removed unused EG(orig_error_reporting)
Update get_class_name semantics
Remove Z_OBJ_CLASS_NAME_P
Improved VM stack primitives for fast paths. Slow paths are not inlined anymore.
...
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r-- | ext/dom/php_dom.c | 37 |
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 */ /* |