zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */
{
- date_period_it *iterator = emalloc(sizeof(date_period_it));
+ date_period_it *iterator;
if (by_ref) {
zend_throw_error(NULL, "An iterator cannot be used with foreach by reference");
return NULL;
}
+ iterator = emalloc(sizeof(date_period_it));
+
zend_iterator_init((zend_object_iterator*)iterator);
ZVAL_COPY(&iterator->intern.data, object);