ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
array_ptr = tmp;
+ if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ ce = Z_OBJCE_P(array_ptr);
+ if (ce && ce->get_iterator) {
+ array_ptr->refcount--;
+ }
+ }
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (!ce || !ce->get_iterator) {
array_ptr->refcount++;
}
} else {
- if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) &&
+ if (OP1_TYPE == IS_CONST ||
+ ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) &&
!array_ptr->is_ref &&
- array_ptr->refcount > 1) {
+ array_ptr->refcount > 1)) {
zval *tmp;
ALLOC_ZVAL(tmp);
}
}
- if (OP1_TYPE != IS_TMP_VAR && ce && ce->get_iterator) {
+ if (ce && ce->get_iterator) {
iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
if (iter && !EG(exception)) {
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
array_ptr = tmp;
+ if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ ce = Z_OBJCE_P(array_ptr);
+ if (ce && ce->get_iterator) {
+ array_ptr->refcount--;
+ }
+ }
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (!ce || !ce->get_iterator) {
array_ptr->refcount++;
}
} else {
- if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
+ if (IS_CONST == IS_CONST ||
+ ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
!array_ptr->is_ref &&
- array_ptr->refcount > 1) {
+ array_ptr->refcount > 1)) {
zval *tmp;
ALLOC_ZVAL(tmp);
}
}
- if (IS_CONST != IS_TMP_VAR && ce && ce->get_iterator) {
+ if (ce && ce->get_iterator) {
iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
if (iter && !EG(exception)) {
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
array_ptr = tmp;
+ if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ ce = Z_OBJCE_P(array_ptr);
+ if (ce && ce->get_iterator) {
+ array_ptr->refcount--;
+ }
+ }
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (!ce || !ce->get_iterator) {
array_ptr->refcount++;
}
} else {
- if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) &&
+ if (IS_TMP_VAR == IS_CONST ||
+ ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) &&
!array_ptr->is_ref &&
- array_ptr->refcount > 1) {
+ array_ptr->refcount > 1)) {
zval *tmp;
ALLOC_ZVAL(tmp);
}
}
- if (IS_TMP_VAR != IS_TMP_VAR && ce && ce->get_iterator) {
+ if (ce && ce->get_iterator) {
iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
if (iter && !EG(exception)) {
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
array_ptr = tmp;
+ if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ ce = Z_OBJCE_P(array_ptr);
+ if (ce && ce->get_iterator) {
+ array_ptr->refcount--;
+ }
+ }
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (!ce || !ce->get_iterator) {
array_ptr->refcount++;
}
} else {
- if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) &&
+ if (IS_VAR == IS_CONST ||
+ ((IS_VAR == IS_CV || IS_VAR == IS_VAR) &&
!array_ptr->is_ref &&
- array_ptr->refcount > 1) {
+ array_ptr->refcount > 1)) {
zval *tmp;
ALLOC_ZVAL(tmp);
}
}
- if (IS_VAR != IS_TMP_VAR && ce && ce->get_iterator) {
+ if (ce && ce->get_iterator) {
iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
if (iter && !EG(exception)) {
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
array_ptr = tmp;
+ if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ ce = Z_OBJCE_P(array_ptr);
+ if (ce && ce->get_iterator) {
+ array_ptr->refcount--;
+ }
+ }
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (!ce || !ce->get_iterator) {
array_ptr->refcount++;
}
} else {
- if ((IS_CV == IS_CV || IS_CV == IS_VAR) &&
+ if (IS_CV == IS_CONST ||
+ ((IS_CV == IS_CV || IS_CV == IS_VAR) &&
!array_ptr->is_ref &&
- array_ptr->refcount > 1) {
+ array_ptr->refcount > 1)) {
zval *tmp;
ALLOC_ZVAL(tmp);
}
}
- if (IS_CV != IS_TMP_VAR && ce && ce->get_iterator) {
+ if (ce && ce->get_iterator) {
iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
if (iter && !EG(exception)) {