diff options
Diffstat (limited to 'Zend/zend_vm_execute.h')
-rw-r--r-- | Zend/zend_vm_execute.h | 1639 |
1 files changed, 830 insertions, 809 deletions
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index e257a7575f..46e1efb750 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -142,7 +142,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.function_name); - }; + } } zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL); @@ -354,7 +354,7 @@ static int ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **param; - zend_uint arg_num = opline->op1.u.constant.value.lval; + zend_uint arg_num = Z_LVAL(opline->op1.u.constant); if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { char *space; @@ -420,7 +420,7 @@ static int ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SELECTIVE_PZVAL_LOCK(object_zval, &opline->result); EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; EX_T(opline->result.u.var).var.ptr = object_zval; - + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), opline); /* We are not handling overloaded classes right now */ @@ -434,13 +434,13 @@ static int ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) static int ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - - EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting); - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */ + + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = EG(error_reporting); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; /* shouldn't be necessary */ if (EX(old_error_reporting) == NULL) { EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var; } - + if (EG(error_reporting)) { zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); } @@ -566,15 +566,15 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } /* restore previous error_reporting value */ - if (!EG(error_reporting) && EX(old_error_reporting) != NULL && EX(old_error_reporting)->value.lval != 0) { - restored_error_reporting.type = IS_LONG; - restored_error_reporting.value.lval = EX(old_error_reporting)->value.lval; + if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) { + Z_TYPE(restored_error_reporting) = IS_LONG; + Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; - + if (encapsulating_block == -1) { ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); } else { @@ -590,7 +590,7 @@ static int ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } static int ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ +{ int ret = zend_user_opcode_handlers[EX(opline)->opcode](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL); switch (ret) { @@ -619,7 +619,7 @@ static int ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = &opline->op2.u.constant; - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -650,8 +650,8 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A if (is_const) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); } else { function_name = &opline->op2.u.constant; @@ -681,7 +681,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A if (IS_CONST != IS_UNUSED && EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); @@ -742,16 +742,16 @@ static int ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **param, *assignment_value; - zend_uint arg_num = opline->op1.u.constant.value.lval; + zend_uint arg_num = Z_LVAL(opline->op1.u.constant); zend_free_op free_res; if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { - if (opline->op2.u.constant.type == IS_CONSTANT || opline->op2.u.constant.type==IS_CONSTANT_ARRAY) { + if (Z_TYPE(opline->op2.u.constant) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { zval *default_value; ALLOC_ZVAL(default_value); *default_value = opline->op2.u.constant; - if (opline->op2.u.constant.type==IS_CONSTANT_ARRAY) { + if (Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { zval_copy_ctor(default_value); } default_value->refcount=1; @@ -819,7 +819,7 @@ static int ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -851,8 +851,8 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_free_op free_op2; if (is_const) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); } else { function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -882,7 +882,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG if (IS_TMP_VAR != IS_UNUSED && EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); @@ -977,7 +977,7 @@ static int ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -1009,8 +1009,8 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_free_op free_op2; if (is_const) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); } else { function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); @@ -1040,7 +1040,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG if (IS_VAR != IS_UNUSED && EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); @@ -1135,7 +1135,7 @@ static int ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = NULL; - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -1166,8 +1166,8 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ if (is_const) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); } else { function_name = NULL; @@ -1197,7 +1197,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_UNUSED != IS_UNUSED && EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); @@ -1225,7 +1225,7 @@ static int ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -1256,8 +1256,8 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (is_const) { - function_name_strval = opline->op2.u.constant.value.str.val; - function_name_strlen = opline->op2.u.constant.value.str.len; + function_name_strval = Z_STRVAL(opline->op2.u.constant); + function_name_strlen = Z_STRLEN(opline->op2.u.constant); } else { function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -1287,7 +1287,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS if (IS_CV != IS_UNUSED && EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && - !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); @@ -1412,8 +1412,8 @@ static int ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -1427,7 +1427,7 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -1447,13 +1447,13 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); + zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); + zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -1467,6 +1467,10 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE } switch (opline->op2.u.EA.type) { case ZEND_FETCH_GLOBAL: + if (IS_CONST != IS_TMP_VAR) { + + } + break; case ZEND_FETCH_LOCAL: break; @@ -1596,8 +1600,8 @@ static int ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(&opline->op1.u.constant); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -1613,8 +1617,8 @@ static int ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(&opline->op1.u.constant); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -1716,7 +1720,7 @@ static int ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) value = &opline->op1.u.constant; - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -1762,8 +1766,8 @@ static int ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(&opline->op1.u.constant); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(&opline->op1.u.constant); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; ZEND_VM_NEXT_OPCODE(); } @@ -1812,11 +1816,11 @@ static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -1890,30 +1894,30 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -1921,7 +1925,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -1963,8 +1967,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -1980,8 +1984,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -1998,7 +2002,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) varname = &opline->op1.u.constant; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -2026,8 +2030,8 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } } - ex = ex->prev_execute_data; - } while (ex && ex->symbol_table == target_symbol_table); + ex = ex->prev_execute_data; + } while (ex && ex->symbol_table == target_symbol_table); } } @@ -2048,7 +2052,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_class_entry *ce = NULL; zend_bool is_empty = 0; - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { array_ptr_ptr = NULL; if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) { ALLOC_INIT_ZVAL(array_ptr); @@ -2057,7 +2061,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_WARNING, "foreach() can not iterate over objects without PHP class"); ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); } - + ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); @@ -2100,12 +2104,12 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (ce && ce->get_iterator) { - iter = ce->get_iterator(ce, array_ptr, 0 TSRMLS_CC); + iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC); if (iter && !EG(exception)) { array_ptr = zend_iterator_wrap(iter TSRMLS_CC); } else { - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { } else { @@ -2138,6 +2142,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_ptr_dtor(&array_ptr); ZEND_VM_NEXT_OPCODE(); } + iter->index = -1; /* will be set to 0 before using next handler */ } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { zend_hash_internal_pointer_reset(fe_ht); if (ce) { @@ -2146,8 +2151,11 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) char *str_key; uint str_key_len; ulong int_key; - if (zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL) == HASH_KEY_IS_STRING - && zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_uchar key_type; + + key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); + if (key_type != HASH_KEY_NON_EXISTANT && + zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -2159,7 +2167,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) is_empty = 1; } - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { } else { @@ -2180,7 +2188,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -2199,21 +2207,21 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -2261,10 +2269,10 @@ static int ZEND_TICKS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - if (++EG(ticks_count)>=opline->op1.u.constant.value.lval) { + if (++EG(ticks_count)>=Z_LVAL(opline->op1.u.constant)) { EG(ticks_count)=0; if (zend_ticks_function) { - zend_ticks_function(opline->op1.u.constant.value.lval); + zend_ticks_function(Z_LVAL(opline->op1.u.constant)); } } ZEND_VM_NEXT_OPCODE(); @@ -2545,7 +2553,7 @@ static int ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS /* This seems to be a reminant of namespaces if (EG(scope)) { ce = EG(scope); - if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { zval_update_constant(value, (void *) 1 TSRMLS_CC); EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); @@ -2620,19 +2628,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -2642,7 +2650,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -2967,19 +2975,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -2989,7 +2997,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -3314,19 +3322,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3336,7 +3344,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -3395,19 +3403,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3417,7 +3425,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -3741,19 +3749,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3763,7 +3771,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -3823,8 +3831,8 @@ static int ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; return ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -3838,7 +3846,7 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -3858,13 +3866,13 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); + zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); + zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -3878,6 +3886,10 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ } switch (opline->op2.u.EA.type) { case ZEND_FETCH_GLOBAL: + if (IS_TMP_VAR != IS_TMP_VAR) { + zval_dtor(free_op1.var); + } + break; case ZEND_FETCH_LOCAL: zval_dtor(free_op1.var); break; @@ -4011,8 +4023,8 @@ static int ZEND_JMPZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); zval_dtor(free_op1.var); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -4029,8 +4041,8 @@ static int ZEND_JMPNZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); zval_dtor(free_op1.var); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -4122,7 +4134,7 @@ static int ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) value = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -4168,8 +4180,8 @@ static int ZEND_BOOL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op1; /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); @@ -4225,11 +4237,11 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -4303,30 +4315,30 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -4334,7 +4346,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -4376,8 +4388,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -4393,8 +4405,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } zval_dtor(free_op1.var); @@ -4411,7 +4423,7 @@ static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) varname = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -4439,8 +4451,8 @@ static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } } - ex = ex->prev_execute_data; - } while (ex && ex->symbol_table == target_symbol_table); + ex = ex->prev_execute_data; + } while (ex && ex->symbol_table == target_symbol_table); } } @@ -4461,7 +4473,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_class_entry *ce = NULL; zend_bool is_empty = 0; - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { array_ptr_ptr = NULL; if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) { ALLOC_INIT_ZVAL(array_ptr); @@ -4470,7 +4482,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_WARNING, "foreach() can not iterate over objects without PHP class"); ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); } - + ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); @@ -4513,12 +4525,12 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (ce && ce->get_iterator) { - iter = ce->get_iterator(ce, array_ptr, 0 TSRMLS_CC); + iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC); if (iter && !EG(exception)) { array_ptr = zend_iterator_wrap(iter TSRMLS_CC); } else { - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { } else { @@ -4551,6 +4563,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_ptr_dtor(&array_ptr); ZEND_VM_NEXT_OPCODE(); } + iter->index = -1; /* will be set to 0 before using next handler */ } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { zend_hash_internal_pointer_reset(fe_ht); if (ce) { @@ -4559,8 +4572,11 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) char *str_key; uint str_key_len; ulong int_key; - if (zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL) == HASH_KEY_IS_STRING - && zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_uchar key_type; + + key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); + if (key_type != HASH_KEY_NON_EXISTANT && + zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -4572,7 +4588,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) is_empty = 1; } - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { } else { @@ -4593,7 +4609,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -4612,21 +4628,21 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -4662,9 +4678,9 @@ static int ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_op *opline = EX(opline); zval restored_error_reporting; - if (!EG(error_reporting) && EX_T(opline->op1.u.var).tmp_var.value.lval != 0) { - restored_error_reporting.type = IS_LONG; - restored_error_reporting.value.lval = EX_T(opline->op1.u.var).tmp_var.value.lval; + if (!EG(error_reporting) && Z_LVAL(EX_T(opline->op1.u.var).tmp_var) != 0) { + Z_TYPE(restored_error_reporting) = IS_LONG; + Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.u.var).tmp_var); convert_to_string(&restored_error_reporting); zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zendi_zval_dtor(restored_error_reporting); @@ -4946,7 +4962,7 @@ static int ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_free_op free_op1; zval *container = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (container->type != IS_ARRAY) { + if (Z_TYPE_P(container) != IS_ARRAY) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); @@ -4955,7 +4971,7 @@ static int ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zval *dim = &opline->op2.u.constant; - EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, dim, BP_VAR_R TSRMLS_CC); + EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC); SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result); } @@ -5003,12 +5019,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -5115,19 +5131,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -5137,7 +5153,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -5431,12 +5447,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -5545,19 +5561,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -5567,7 +5583,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -5861,12 +5877,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -5975,19 +5991,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -5997,7 +6013,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -6056,19 +6072,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -6078,7 +6094,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -6371,12 +6387,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -6483,19 +6499,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -6505,7 +6521,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -6727,8 +6743,8 @@ static int ZEND_PRINT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; return ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -6742,7 +6758,7 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -6762,13 +6778,13 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); + zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); + zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -6782,6 +6798,10 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ } switch (opline->op2.u.EA.type) { case ZEND_FETCH_GLOBAL: + if (IS_VAR != IS_TMP_VAR) { + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } + break; case ZEND_FETCH_LOCAL: if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; break; @@ -6915,8 +6935,8 @@ static int ZEND_JMPZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -6933,8 +6953,8 @@ static int ZEND_JMPNZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -7020,7 +7040,7 @@ static int ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) value = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -7100,12 +7120,12 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - + varptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || EX_T(opline->op1.u.var).var.fcall_returned_reference) && - varptr != &EG(uninitialized_zval) && - (PZVAL_IS_REF(varptr) || + varptr != &EG(uninitialized_zval) && + (PZVAL_IS_REF(varptr) || (varptr->refcount == 1 && (IS_VAR == IS_CV || free_op1.var)))) { varptr->is_ref = 1; varptr->refcount++; @@ -7163,8 +7183,8 @@ static int ZEND_BOOL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op1; /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); @@ -7220,11 +7240,11 @@ static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -7298,30 +7318,30 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -7329,7 +7349,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -7371,8 +7391,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -7388,8 +7408,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -7406,7 +7426,7 @@ static int ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) varname = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -7434,8 +7454,8 @@ static int ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } } - ex = ex->prev_execute_data; - } while (ex && ex->symbol_table == target_symbol_table); + ex = ex->prev_execute_data; + } while (ex && ex->symbol_table == target_symbol_table); } } @@ -7456,7 +7476,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_class_entry *ce = NULL; zend_bool is_empty = 0; - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { array_ptr_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) { ALLOC_INIT_ZVAL(array_ptr); @@ -7465,7 +7485,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_WARNING, "foreach() can not iterate over objects without PHP class"); ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); } - + ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); @@ -7508,12 +7528,12 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (ce && ce->get_iterator) { - iter = ce->get_iterator(ce, array_ptr, 0 TSRMLS_CC); + iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC); if (iter && !EG(exception)) { array_ptr = zend_iterator_wrap(iter TSRMLS_CC); } else { - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } else { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -7546,6 +7566,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_ptr_dtor(&array_ptr); ZEND_VM_NEXT_OPCODE(); } + iter->index = -1; /* will be set to 0 before using next handler */ } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { zend_hash_internal_pointer_reset(fe_ht); if (ce) { @@ -7554,8 +7575,11 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) char *str_key; uint str_key_len; ulong int_key; - if (zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL) == HASH_KEY_IS_STRING - && zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_uchar key_type; + + key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); + if (key_type != HASH_KEY_NON_EXISTANT && + zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -7567,7 +7591,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) is_empty = 1; } - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } else { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -7614,7 +7638,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); zend_hash_move_forward(fe_ht); - } while (key_type != HASH_KEY_IS_STRING || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS); + } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS); if (use_key) { zend_unmangle_property_name_ex(str_key, str_key_len, &class_name, &prop_name); str_key_len = strlen(prop_name); @@ -7638,7 +7662,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case ZEND_ITER_OBJECT: /* !iter happens from exception */ - if (iter && iter->index++) { + if (iter && ++iter->index > 0) { /* This could cause an endless loop if index becomes zero again. * In case that ever happens we need an additional flag. */ iter->funcs->move_forward(iter TSRMLS_CC); @@ -7648,7 +7672,8 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } } - if (!iter || (iter->index > 1 && iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) { + /* If index is zero we come from FE_RESET and checked valid() already. */ + if (!iter || (iter->index > 0 && iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) { /* reached end of iteration */ if (EG(exception)) { array->refcount--; @@ -7680,7 +7705,6 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int_key = iter->index; } } - break; } @@ -7701,15 +7725,16 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) switch (key_type) { case HASH_KEY_IS_STRING: - key->value.str.val = str_key; - key->value.str.len = str_key_len-1; - key->type = IS_STRING; + Z_STRVAL_P(key) = str_key; + Z_STRLEN_P(key) = str_key_len-1; + Z_TYPE_P(key) = IS_STRING; break; case HASH_KEY_IS_LONG: - key->value.lval = int_key; - key->type = IS_LONG; + Z_LVAL_P(key) = int_key; + Z_TYPE_P(key) = IS_LONG; break; default: + case HASH_KEY_NON_EXISTANT: ZVAL_NULL(key); break; } @@ -7728,7 +7753,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -7747,21 +7772,21 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -8074,7 +8099,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -8121,7 +8146,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -8188,7 +8213,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *re (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -8323,7 +8348,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZE make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -8358,7 +8383,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZE if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -8415,7 +8440,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -8448,7 +8473,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -8550,7 +8575,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR zend_free_op free_op1; int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_CONST == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -8619,7 +8644,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -8792,7 +8817,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -8839,12 +8864,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -8952,19 +8977,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -8974,7 +8999,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -9005,17 +9030,15 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -9124,22 +9147,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, zval *offset = &opline->op2.u.constant; - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -9177,7 +9201,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -9194,13 +9218,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -9220,14 +9244,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -9497,7 +9521,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); zval_dtor(free_op2.var); FREE_OP(free_op_data1); @@ -9544,7 +9568,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -9611,7 +9635,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *resu (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -9747,7 +9771,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -9782,7 +9806,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -9839,7 +9863,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); *retval = *EG(uninitialized_zval_ptr); @@ -9872,7 +9896,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -9974,7 +9998,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_free_op free_op1, free_op2; int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_TMP_VAR == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -10043,7 +10067,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_O } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -10216,7 +10240,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -10264,12 +10288,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -10379,19 +10403,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -10401,7 +10425,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -10432,17 +10456,15 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -10551,22 +10573,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -10604,7 +10627,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE break; } zval_dtor(free_op2.var); - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -10621,13 +10644,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -10647,14 +10670,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -10924,7 +10947,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; FREE_OP(free_op_data1); @@ -10971,7 +10994,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -11038,7 +11061,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *resu (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -11174,7 +11197,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -11209,7 +11232,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -11266,7 +11289,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; *retval = *EG(uninitialized_zval_ptr); @@ -11299,7 +11322,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -11401,7 +11424,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_free_op free_op1, free_op2; int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_VAR == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -11470,7 +11493,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_O } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -11643,7 +11666,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -11686,7 +11709,7 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_VAR == IS_VAR && value_ptr_ptr && !(*value_ptr_ptr)->is_ref && - opline->extended_value == ZEND_RETURNS_FUNCTION && + opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ @@ -11729,12 +11752,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -11844,19 +11867,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -11866,7 +11889,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -11897,17 +11920,15 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -12016,22 +12037,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -12069,7 +12091,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE break; } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -12086,13 +12108,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -12112,14 +12134,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -12155,7 +12177,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -12202,7 +12224,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -12269,7 +12291,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *r (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -12421,7 +12443,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_A zend_free_op free_op1; int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_UNUSED == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -12446,7 +12468,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -12509,19 +12531,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -12531,7 +12553,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -12797,7 +12819,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -12844,7 +12866,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -12911,7 +12933,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *resul (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -13046,7 +13068,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_ make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -13081,7 +13103,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_ if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -13138,7 +13160,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -13171,7 +13193,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -13273,7 +13295,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op1; int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_CV == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -13342,7 +13364,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OP } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -13515,7 +13537,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -13556,7 +13578,7 @@ static int ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_CV == IS_VAR && value_ptr_ptr && !(*value_ptr_ptr)->is_ref && - opline->extended_value == ZEND_RETURNS_FUNCTION && + opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ @@ -13598,12 +13620,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -13711,19 +13733,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -13733,7 +13755,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -13764,17 +13786,15 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -13883,22 +13903,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -13936,7 +13957,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -13953,13 +13974,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -13979,14 +14000,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -14049,11 +14070,11 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -14096,7 +14117,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -14143,7 +14164,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -14209,7 +14230,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -14344,7 +14365,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -14379,7 +14400,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -14436,7 +14457,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -14469,7 +14490,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -14537,7 +14558,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, Z } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -14708,7 +14729,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -14743,12 +14764,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_A zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_obj_zval_ptr_unused(TSRMLS_C); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -14790,7 +14811,7 @@ static int ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG /* This seems to be a reminant of namespaces if (EG(scope)) { ce = EG(scope); - if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { zval_update_constant(value, (void *) 1 TSRMLS_CC); EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); @@ -14865,19 +14886,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -14887,7 +14908,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -14918,17 +14939,15 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -15035,22 +15054,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di zval *offset = &opline->op2.u.constant; - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -15088,7 +15108,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -15105,13 +15125,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -15131,14 +15151,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -15172,7 +15192,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); zval_dtor(free_op2.var); FREE_OP(free_op_data1); @@ -15219,7 +15239,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -15285,7 +15305,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *r (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -15421,7 +15441,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, Z make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -15456,7 +15476,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, Z if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -15513,7 +15533,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); *retval = *EG(uninitialized_zval_ptr); @@ -15546,7 +15566,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -15614,7 +15634,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEN } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -15785,7 +15805,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -15821,12 +15841,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_obj_zval_ptr_unused(TSRMLS_C); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -15903,19 +15923,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -15925,7 +15945,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -15956,17 +15976,15 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -16073,22 +16091,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -16126,7 +16145,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, break; } zval_dtor(free_op2.var); - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -16143,13 +16162,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -16169,14 +16188,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -16210,7 +16229,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; FREE_OP(free_op_data1); @@ -16257,7 +16276,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -16323,7 +16342,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *r (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -16459,7 +16478,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, Z make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -16494,7 +16513,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, Z if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -16551,7 +16570,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; *retval = *EG(uninitialized_zval_ptr); @@ -16584,7 +16603,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -16652,7 +16671,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEN } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -16823,7 +16842,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -16859,12 +16878,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_obj_zval_ptr_unused(TSRMLS_C); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -16941,19 +16960,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -16963,7 +16982,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -16994,17 +17013,15 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -17111,22 +17128,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -17164,7 +17182,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, break; } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -17181,13 +17199,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -17207,14 +17225,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -17248,7 +17266,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -17295,7 +17313,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -17361,7 +17379,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -17497,7 +17515,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -17560,19 +17578,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -17582,7 +17600,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -17614,7 +17632,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -17661,7 +17679,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -17727,7 +17745,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *re (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -17862,7 +17880,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZE make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -17897,7 +17915,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZE if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -17954,7 +17972,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -17987,7 +18005,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -18055,7 +18073,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -18226,7 +18244,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -18261,12 +18279,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_obj_zval_ptr_unused(TSRMLS_C); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -18342,19 +18360,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -18364,7 +18382,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -18395,17 +18413,15 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -18512,22 +18528,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -18565,7 +18582,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -18582,13 +18599,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -18608,14 +18625,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -18834,8 +18851,8 @@ static int ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; return ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -18849,7 +18866,7 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_string(&tmp_varname); @@ -18869,13 +18886,13 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); + zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); + zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); /* break missing intentionally */ case BP_VAR_W: { zval *new_zval = &EG(uninitialized_zval); @@ -18889,6 +18906,10 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A } switch (opline->op2.u.EA.type) { case ZEND_FETCH_GLOBAL: + if (IS_CV != IS_TMP_VAR) { + + } + break; case ZEND_FETCH_LOCAL: break; @@ -19018,8 +19039,8 @@ static int ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -19035,8 +19056,8 @@ static int ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -19122,7 +19143,7 @@ static int ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) value = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -19202,12 +19223,12 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { return zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - + varptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || EX_T(opline->op1.u.var).var.fcall_returned_reference) && - varptr != &EG(uninitialized_zval) && - (PZVAL_IS_REF(varptr) || + varptr != &EG(uninitialized_zval) && + (PZVAL_IS_REF(varptr) || (varptr->refcount == 1 && (IS_CV == IS_CV || free_op1.var)))) { varptr->is_ref = 1; varptr->refcount++; @@ -19264,8 +19285,8 @@ static int ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; ZEND_VM_NEXT_OPCODE(); } @@ -19314,11 +19335,11 @@ static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -19392,30 +19413,30 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -19423,7 +19444,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -19465,8 +19486,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -19482,8 +19503,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -19500,7 +19521,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) varname = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -19528,8 +19549,8 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } } - ex = ex->prev_execute_data; - } while (ex && ex->symbol_table == target_symbol_table); + ex = ex->prev_execute_data; + } while (ex && ex->symbol_table == target_symbol_table); } } @@ -19550,7 +19571,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_class_entry *ce = NULL; zend_bool is_empty = 0; - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { array_ptr_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) { ALLOC_INIT_ZVAL(array_ptr); @@ -19559,7 +19580,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_WARNING, "foreach() can not iterate over objects without PHP class"); ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); } - + ce = Z_OBJCE_PP(array_ptr_ptr); if (!ce || ce->get_iterator == NULL) { SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); @@ -19602,12 +19623,12 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (ce && ce->get_iterator) { - iter = ce->get_iterator(ce, array_ptr, 0 TSRMLS_CC); + iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC); if (iter && !EG(exception)) { array_ptr = zend_iterator_wrap(iter TSRMLS_CC); } else { - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { } else { @@ -19640,6 +19661,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_ptr_dtor(&array_ptr); ZEND_VM_NEXT_OPCODE(); } + iter->index = -1; /* will be set to 0 before using next handler */ } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { zend_hash_internal_pointer_reset(fe_ht); if (ce) { @@ -19648,8 +19670,11 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) char *str_key; uint str_key_len; ulong int_key; - if (zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL) == HASH_KEY_IS_STRING - && zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_uchar key_type; + + key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); + if (key_type != HASH_KEY_NON_EXISTANT && + zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -19661,7 +19686,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) is_empty = 1; } - if (opline->extended_value) { + if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { } else { @@ -19682,7 +19707,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING) { + if (Z_TYPE_P(varname) != IS_STRING) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -19701,21 +19726,21 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -20027,7 +20052,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -20074,7 +20099,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -20140,7 +20165,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *res (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -20275,7 +20300,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEN make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -20310,7 +20335,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEN if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -20367,7 +20392,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -20400,7 +20425,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -20502,7 +20527,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_CONST == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -20571,7 +20596,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_ } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -20742,7 +20767,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -20789,12 +20814,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -20901,19 +20926,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -20923,7 +20948,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -20954,17 +20979,15 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -21071,22 +21094,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z zval *offset = &opline->op2.u.constant; - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -21124,7 +21148,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -21141,13 +21165,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -21167,14 +21191,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -21442,7 +21466,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); zval_dtor(free_op2.var); FREE_OP(free_op_data1); @@ -21489,7 +21513,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -21555,7 +21579,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *resul (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -21691,7 +21715,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_ make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -21726,7 +21750,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_ if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -21783,7 +21807,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); *retval = *EG(uninitialized_zval_ptr); @@ -21816,7 +21840,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -21918,7 +21942,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op2; int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_TMP_VAR == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -21987,7 +22011,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OP } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -22158,7 +22182,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -22206,12 +22230,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -22320,19 +22344,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -22342,7 +22366,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -22373,17 +22397,15 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -22490,22 +22512,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -22543,7 +22566,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN break; } zval_dtor(free_op2.var); - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -22560,13 +22583,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -22586,14 +22609,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -22861,7 +22884,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; FREE_OP(free_op_data1); @@ -22908,7 +22931,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -22974,7 +22997,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *resul (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -23110,7 +23133,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_ make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -23145,7 +23168,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_ if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -23202,7 +23225,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; *retval = *EG(uninitialized_zval_ptr); @@ -23235,7 +23258,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -23337,7 +23360,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op2; int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_VAR == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -23406,7 +23429,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OP } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -23577,7 +23600,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -23620,7 +23643,7 @@ static int ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_VAR == IS_VAR && value_ptr_ptr && !(*value_ptr_ptr)->is_ref && - opline->extended_value == ZEND_RETURNS_FUNCTION && + opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ @@ -23662,12 +23685,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -23776,19 +23799,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -23798,7 +23821,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -23829,17 +23852,15 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -23946,22 +23967,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -23999,7 +24021,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN break; } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -24016,13 +24038,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -24042,14 +24064,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -24083,7 +24105,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -24130,7 +24152,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -24196,7 +24218,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *re (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -24348,7 +24370,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_UNUSED == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -24373,7 +24395,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -24436,19 +24458,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -24458,7 +24480,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -24724,7 +24746,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -24771,7 +24793,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -24837,7 +24859,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -24972,7 +24994,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_O make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -25007,7 +25029,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_O if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -25064,7 +25086,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_ make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -25097,7 +25119,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -25199,7 +25221,7 @@ static int ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int type = ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)?BP_VAR_W:BP_VAR_R; zval *dim; - + if (IS_CV == IS_UNUSED && type == BP_VAR_R) { zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); } @@ -25268,7 +25290,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPC } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -25439,7 +25461,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -25480,7 +25502,7 @@ static int ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_CV == IS_VAR && value_ptr_ptr && !(*value_ptr_ptr)->is_ref && - opline->extended_value == ZEND_RETURNS_FUNCTION && + opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op2.u.var).var.fcall_returned_reference) { if (free_op2.var == NULL) { PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ @@ -25521,12 +25543,12 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error_noreturn(E_ERROR, "Method name must be a string"); } - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); EX(object) = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -25633,19 +25655,19 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -25655,7 +25677,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -25686,17 +25708,15 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + zend_hash_index_del(ht, index); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } - + index = Z_LVAL_P(offset); zend_hash_index_del(ht, index); break; case IS_STRING: @@ -25803,22 +25823,23 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: + index = (long) Z_DVAL_P(offset); + if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { + isset = 1; + } + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; - } else { - index = offset->value.lval; - } + index = Z_LVAL_P(offset); if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; } @@ -25856,7 +25877,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -25873,13 +25894,13 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -25899,14 +25920,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } |