From d87927c3889ba3186c80a622868568aa8a2f9647 Mon Sep 17 00:00:00 2001
From: Marcus Boerger <helly@php.net>
Date: Thu, 16 Feb 2006 01:12:51 +0000
Subject: [PATCH] - Fix iterator handling (how did the fix after api change get
 lost here?) - In php 5 we do not want to return &new

---
 ext/sqlite/sqlite.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 9c1ba5e278..5366d098b1 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -895,7 +895,7 @@ static zval * sqlite_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC)
 	Z_TYPE_P(object) = IS_OBJECT;
 	object_init_ex(object, pce);
 	object->refcount = 1;
-	object->is_ref = 1;
+	object->is_ref = 0;
 	return object;
 }
 
@@ -1002,9 +1002,15 @@ zend_object_iterator_funcs sqlite_query_iterator_funcs = {
 	sqlite_iterator_rewind
 };
 
-zend_object_iterator *sqlite_get_iterator(zend_class_entry *ce, zval *object TSRMLS_DC)
+zend_object_iterator *sqlite_get_iterator(zend_class_entry *ce, zval *object, int by_ref  TSRMLS_DC)
 {
-	sqlite_object_iterator *iterator = emalloc(sizeof(sqlite_object_iterator));
+	sqlite_object_iterator *iterator;
+
+	if (by_ref) {
+		zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
+	}
+
+	iterator = emalloc(sizeof(sqlite_object_iterator));
 
 	sqlite_object *obj = (sqlite_object*) zend_object_store_get_object(object TSRMLS_CC);
 
-- 
2.40.0