}
if (EG(This)) {
- if (EG(exception) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
+ if (EG(exception) && EX(fbc) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
EG(This)->refcount--;
zval_ptr_dtor(&EG(This));
} else if (should_change_scope) {
break;
case ZEND_ITER_OBJECT:
- if (iter->funcs->has_more(iter TSRMLS_CC) == FAILURE) {
+ /* !iter happens from exception */
+ if (!iter || iter->funcs->has_more(iter TSRMLS_CC) == FAILURE) {
/* reached end of iteration */
EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num;
return 0; /* CHECK_ME */
/* {{{ zend_user_has_more */
static int zend_user_has_more(zend_object_iterator *_iter TSRMLS_DC)
{
- zend_user_iterator *iter = (zend_user_iterator*)_iter;
- zval *object = (zval*)iter->it.data;
- zval *more;
- int result;
-
- zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_has_more, "hasmore", &more);
- result = i_zend_is_true(more);
- zval_dtor(more);
- FREE_ZVAL(more);
- return result ? SUCCESS : FAILURE;
+ if (_iter) {
+ zend_user_iterator *iter = (zend_user_iterator*)_iter;
+ zval *object = (zval*)iter->it.data;
+ zval *more;
+ int result;
+
+ zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_has_more, "hasmore", &more);
+ if (more) {
+ result = i_zend_is_true(more);
+ zval_dtor(more);
+ FREE_ZVAL(more);
+ return result ? SUCCESS : FAILURE;
+ }
+ }
+ return FAILURE;
}
/* }}} */