From: Rob Richards Date: Tue, 7 Feb 2006 11:48:37 +0000 (+0000) Subject: modify get_iterator call for engine change X-Git-Tag: RELEASE_1_2~246 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1e5c3f3b21adcba04193f571590309942f83085;p=php modify get_iterator call for engine change --- diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index 3408ff25bb..865400d655 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -250,7 +250,7 @@ zend_object_iterator_funcs php_dom_iterator_funcs = { NULL }; -zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TSRMLS_DC) +zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) { dom_object *intern; dom_nnodemap_object *objmap; @@ -259,8 +259,13 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TS int ret, curindex = 0; HashTable *nodeht; zval **entry; + php_dom_iterator *iterator; - php_dom_iterator *iterator = emalloc(sizeof(php_dom_iterator)); + if (by_ref) { + zend_error(E_ERROR, "An iterator cannot be used with foreach by reference"); + } + + iterator = emalloc(sizeof(php_dom_iterator)); object->refcount++; iterator->intern.data = (void*)object; diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index fb1a02202c..7afbbf0442 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -109,7 +109,7 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index); xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index); -zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TSRMLS_DC); +zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce TSRMLS_DC); #define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \