php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #60762
Patch set-index revision 2018-08-19 15:27 UTC by cmb@php.net

Patch set-index for SPL related Bug #60762

Patch version 2018-08-19 15:27 UTC

Return to Bug #60762 | Download this patch
Patch Revisions:

Developer: cmb@php.net

 ext/spl/spl_iterators.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 2ddb7b2a4f..21cac05658 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1667,6 +1667,7 @@ static inline void spl_dual_it_rewind(spl_dual_it_object *intern)
 {
 	spl_dual_it_free(intern);
 	intern->current.pos = 0;
+	intern->inner.iterator->index = 0;
 	if (intern->inner.iterator && intern->inner.iterator->funcs->rewind) {
 		intern->inner.iterator->funcs->rewind(intern->inner.iterator);
 	}
@@ -1714,6 +1715,7 @@ static inline void spl_dual_it_next(spl_dual_it_object *intern, int do_free)
 		zend_throw_error(NULL, "The inner constructor wasn't initialized with an iterator instance");
 		return;
 	}
+	intern->inner.iterator->index++;
 	intern->inner.iterator->funcs->move_forward(intern->inner.iterator);
 	intern->current.pos++;
 }
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 11:01:23 2020 UTC