mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fixed iterators API. zend_iterator_init() has to be used in each get_iterator() callback.
This commit is contained in:
parent
a4a86df3c0
commit
495551aa8c
12 changed files with 45 additions and 23 deletions
|
@ -65,11 +65,10 @@ static void iter_wrapper_dtor(zend_object *object TSRMLS_DC)
|
|||
iter->funcs->dtor(iter TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API void zend_iterator_wrap(zend_object_iterator *iter, zval *wrapped TSRMLS_DC)
|
||||
ZEND_API void zend_iterator_init(zend_object_iterator *iter TSRMLS_DC)
|
||||
{
|
||||
ZVAL_OBJ(wrapped, &iter->std);
|
||||
//??? hack (it would be better implement it in anothe way)
|
||||
Z_OBJ_HT_P(wrapped) = &iterator_object_handlers;
|
||||
zend_object_std_init(&iter->std, &zend_iterator_class_entry);
|
||||
iter->std.handlers = &iterator_object_handlers;
|
||||
}
|
||||
|
||||
ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue