]> granicus.if.org Git - php/commitdiff
modify get_iterator call for engine change
authorRob Richards <rrichards@php.net>
Tue, 7 Feb 2006 11:48:37 +0000 (11:48 +0000)
committerRob Richards <rrichards@php.net>
Tue, 7 Feb 2006 11:48:37 +0000 (11:48 +0000)
ext/dom/dom_iterators.c
ext/dom/php_dom.h

index 3408ff25bbb7d6efe9c1be800168e1ee80e993e2..865400d655b6bbf555f3b7d1ef737558e149b500 100644 (file)
@@ -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;
index fb1a02202c7eac90d426717363f3ef49ad9997da..7afbbf0442bb8e4260b4c9186f8d6278c739e1b9 100644 (file)
@@ -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) \