Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Allow getIterator() to fail

  • Loading branch information...
commit 5206e9c9cf2703e21f4f5dec1bf2d9c8531c80d8 1 parent be86e16
Marcus Boerger authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 Zend/zend_interfaces.c
View
12 Zend/zend_interfaces.c
@@ -270,11 +270,17 @@ static zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce,
zval *iterator = zend_user_it_new_iterator(ce, object TSRMLS_CC);
zend_object_iterator *new_iterator;
- zend_class_entry *ce_it = Z_TYPE_P(iterator) == IS_OBJECT ? Z_OBJCE_P(iterator) : NULL;
+ zend_class_entry *ce_it = iterator && Z_TYPE_P(iterator) == IS_OBJECT ? Z_OBJCE_P(iterator) : NULL;
if (!ce || !ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && iterator == object)) {
- zend_error(E_WARNING, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce->name);
- zval_ptr_dtor(&iterator);
+ if (!EG(exception))
+ {
+ zend_error(E_WARNING, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce->name);
+ }
+ if (iterator)
+ {
+ zval_ptr_dtor(&iterator);
+ }
return NULL;
}
new_iterator = ce_it->get_iterator(ce_it, iterator TSRMLS_CC);
Please sign in to comment.
Something went wrong with that request. Please try again.