summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_execute.c43
-rw-r--r--Zend/zend_vm_def.h97
-rw-r--r--Zend/zend_vm_execute.h382
3 files changed, 57 insertions, 465 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 354b3f3eba..5396334091 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -3188,6 +3188,49 @@ ZEND_API int ZEND_FASTCALL zend_do_fcall_overloaded(zend_execute_data *call, zva
}
/* }}} */
+static zend_never_inline zend_bool ZEND_FASTCALL zend_fe_reset_iterator(zval *array_ptr, int by_ref OPLINE_DC) /* {{{ */
+{
+ zend_class_entry *ce = Z_OBJCE_P(array_ptr);
+ zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, by_ref);
+ zend_bool is_empty;
+
+ if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
+ if (iter) {
+ OBJ_RELEASE(&iter->std);
+ }
+ if (!EG(exception)) {
+ zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
+ }
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ return 1;
+ }
+
+ iter->index = 0;
+ if (iter->funcs->rewind) {
+ iter->funcs->rewind(iter);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ OBJ_RELEASE(&iter->std);
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ return 1;
+ }
+ }
+
+ is_empty = iter->funcs->valid(iter) != SUCCESS;
+
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ OBJ_RELEASE(&iter->std);
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ return 1;
+ }
+ iter->index = -1; /* will be set to 0 before using next handler */
+
+ ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+
+ return is_empty;
+}
+/* }}} */
+
#ifdef ZEND_VM_TRACE_HANDLERS
# include "zend_vm_trace_handlers.h"
#elif defined(ZEND_VM_TRACE_MAP)
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 8554034151..471725107b 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -5687,45 +5687,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 0);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- FREE_OP1();
- if (iter) {
- OBJ_RELEASE(&iter->std);
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- FREE_OP1();
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- FREE_OP1();
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC);
FREE_OP1();
if (UNEXPECTED(EG(exception))) {
@@ -5783,9 +5745,7 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR)
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_ARRVAL_P(array_ptr), 0);
- if (OP1_TYPE == IS_VAR) {
- FREE_OP1_VAR_PTR();
- }
+ FREE_OP1_VAR_PTR();
ZEND_VM_NEXT_OPCODE();
} else if (OP1_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
@@ -5809,59 +5769,10 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR)
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
- if (OP1_TYPE == IS_VAR) {
- FREE_OP1_VAR_PTR();
- }
+ FREE_OP1_VAR_PTR();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 1);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (OP1_TYPE == IS_VAR) {
- FREE_OP1_VAR_PTR();
- } else {
- FREE_OP1();
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (OP1_TYPE == IS_VAR) {
- FREE_OP1_VAR_PTR();
- } else {
- FREE_OP1();
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (OP1_TYPE == IS_VAR) {
- FREE_OP1_VAR_PTR();
- } else {
- FREE_OP1();
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 1 OPLINE_CC);
if (OP1_TYPE == IS_VAR) {
FREE_OP1_VAR_PTR();
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 3db1a969f2..6889571b50 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -3400,45 +3400,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 0);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
-
- if (iter) {
- OBJ_RELEASE(&iter->std);
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
-
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
-
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC);
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -3495,9 +3457,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_ARRVAL_P(array_ptr), 0);
- if (IS_CONST == IS_VAR) {
-
- }
ZEND_VM_NEXT_OPCODE();
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
@@ -3521,59 +3480,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
- if (IS_CONST == IS_VAR) {
-
- }
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 1);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (IS_CONST == IS_VAR) {
-
- } else {
-
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (IS_CONST == IS_VAR) {
-
- } else {
-
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (IS_CONST == IS_VAR) {
-
- } else {
-
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 1 OPLINE_CC);
if (IS_CONST == IS_VAR) {
@@ -18126,45 +18035,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 0);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- zval_ptr_dtor_nogc(free_op1);
- if (iter) {
- OBJ_RELEASE(&iter->std);
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- zval_ptr_dtor_nogc(free_op1);
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- zval_ptr_dtor_nogc(free_op1);
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC);
zval_ptr_dtor_nogc(free_op1);
if (UNEXPECTED(EG(exception))) {
@@ -18222,9 +18093,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_ARRVAL_P(array_ptr), 0);
- if (IS_TMP_VAR == IS_VAR) {
-
- }
ZEND_VM_NEXT_OPCODE();
} else if (IS_TMP_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
@@ -18248,59 +18116,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
- if (IS_TMP_VAR == IS_VAR) {
-
- }
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 1);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (IS_TMP_VAR == IS_VAR) {
-
- } else {
- zval_ptr_dtor_nogc(free_op1);
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (IS_TMP_VAR == IS_VAR) {
-
- } else {
- zval_ptr_dtor_nogc(free_op1);
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (IS_TMP_VAR == IS_VAR) {
-
- } else {
- zval_ptr_dtor_nogc(free_op1);
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 1 OPLINE_CC);
if (IS_TMP_VAR == IS_VAR) {
@@ -21307,45 +21125,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
zval_ptr_dtor_nogc(free_op1);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 0);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- zval_ptr_dtor_nogc(free_op1);
- if (iter) {
- OBJ_RELEASE(&iter->std);
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- zval_ptr_dtor_nogc(free_op1);
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- zval_ptr_dtor_nogc(free_op1);
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC);
zval_ptr_dtor_nogc(free_op1);
if (UNEXPECTED(EG(exception))) {
@@ -21403,9 +21183,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_ARRVAL_P(array_ptr), 0);
- if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- }
+ if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
ZEND_VM_NEXT_OPCODE();
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
@@ -21429,59 +21207,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
- if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- }
+ if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 1);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- } else {
- zval_ptr_dtor_nogc(free_op1);
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- } else {
- zval_ptr_dtor_nogc(free_op1);
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- } else {
- zval_ptr_dtor_nogc(free_op1);
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 1 OPLINE_CC);
if (IS_VAR == IS_VAR) {
if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
@@ -37542,45 +37271,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 0);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
-
- if (iter) {
- OBJ_RELEASE(&iter->std);
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
-
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
-
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC);
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -37637,9 +37328,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_ARRVAL_P(array_ptr), 0);
- if (IS_CV == IS_VAR) {
-
- }
ZEND_VM_NEXT_OPCODE();
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
@@ -37663,59 +37351,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
- if (IS_CV == IS_VAR) {
-
- }
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
- zend_class_entry *ce = Z_OBJCE_P(array_ptr);
- zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 1);
- zend_bool is_empty;
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (IS_CV == IS_VAR) {
-
- } else {
-
- }
- if (!EG(exception)) {
- zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (IS_CV == IS_VAR) {
-
- } else {
-
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- }
-
- is_empty = iter->funcs->valid(iter) != SUCCESS;
-
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- if (IS_CV == IS_VAR) {
-
- } else {
-
- }
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- iter->index = -1; /* will be set to 0 before using next handler */
-
- ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
+ zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 1 OPLINE_CC);
if (IS_CV == IS_VAR) {