diff options
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r-- | ext/dom/php_dom.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 71c06612db..c25cbaba58 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1552,8 +1552,7 @@ zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv return NULL; } - ZVAL_COPY(&offset_copy, offset); - convert_to_long(&offset_copy); + ZVAL_LONG(&offset_copy, zval_get_long(offset)); zend_call_method_with_1_params(object, Z_OBJCE_P(object), NULL, "item", rv, &offset_copy); @@ -1562,21 +1561,15 @@ zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv 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); + zend_long offset = zval_get_long(member); - if (Z_LVAL(offset_copy) < 0) { + if (offset < 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); + } else { + zval *length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0 TSRMLS_CC); - return ret; + return length && offset < Z_LVAL_P(length); + } } /* }}} end dom_nodelist_has_dimension */ #endif /* HAVE_DOM */ |