summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2006-02-07 11:48:37 +0000
committerRob Richards <rrichards@php.net>2006-02-07 11:48:37 +0000
commite1e5c3f3b21adcba04193f571590309942f83085 (patch)
tree2741d835d02a06916ac68747fdafb355ce601244
parentd2148ac8e522c9754c732c46cf6ec0af8b11d9db (diff)
downloadphp-git-e1e5c3f3b21adcba04193f571590309942f83085.tar.gz
modify get_iterator call for engine change
-rw-r--r--ext/dom/dom_iterators.c9
-rw-r--r--ext/dom/php_dom.h2
2 files changed, 8 insertions, 3 deletions
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) \