diff options
-rw-r--r-- | Zend/zend_compile.c | 7 | ||||
-rw-r--r-- | Zend/zend_execute.h | 8 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 1 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 110 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 132 | ||||
-rw-r--r-- | ext/pcre/php_pcre.c | 2 |
6 files changed, 195 insertions, 65 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 6eec6615af..c196e39887 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2406,6 +2406,7 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */ zend_compile_expr(&arg_node, arg->child[0]); opline = zend_emit_op(NULL, ZEND_SEND_UNPACK, &arg_node, NULL); opline->op2.num = arg_count; + opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_ARG(NULL, arg_count); continue; } @@ -2468,6 +2469,7 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */ SET_NODE(opline->op1, &arg_node); SET_UNUSED(opline->op2); opline->op2.opline_num = arg_num; + opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_ARG(NULL, arg_num); if (opcode == ZEND_SEND_VAR_NO_REF) { if (fbc) { @@ -2695,7 +2697,7 @@ int zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcna return FAILURE; } - zend_compile_init_user_func(args->child[0], 1, lcname); + zend_compile_init_user_func(args->child[0], 0, lcname); zend_compile_expr(&arg_node, args->child[1]); zend_emit_op(NULL, ZEND_SEND_ARRAY, &arg_node, NULL); zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL); @@ -2736,7 +2738,8 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam opline = zend_emit_op(NULL, ZEND_SEND_VAL, &arg_node, NULL); } - opline->op2.opline_num = i; + opline->op2.num = i; + opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_ARG(NULL, i); } zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index a62f809cce..33463e05ac 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -143,14 +143,14 @@ static zend_always_inline zval* zend_vm_stack_alloc(size_t size) return (zval*)top; } -static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t call_info, zend_function *func, uint32_t used_stack, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev) +static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t used_stack, uint32_t call_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev) { zend_execute_data *call = (zend_execute_data*)zend_vm_stack_alloc(used_stack); call->func = func; Z_OBJ(call->This) = object; ZEND_SET_CALL_INFO(call, call_info); - ZEND_CALL_NUM_ARGS(call) = 0; + ZEND_CALL_NUM_ARGS(call) = num_args; call->called_scope = called_scope; call->prev_execute_data = prev; return call; @@ -170,8 +170,8 @@ static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint3 { uint32_t used_stack = zend_vm_calc_used_stack(num_args, func); - return zend_vm_stack_push_call_frame_ex(call_info, - func, used_stack, called_scope, object, prev); + return zend_vm_stack_push_call_frame_ex(used_stack, call_info, + func, num_args, called_scope, object, prev); } static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *call) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index cfdfaa6134..10238e0396 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -815,7 +815,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) / ZVAL_COPY(param, &fci->params[i]); } } - ZEND_CALL_NUM_ARGS(call) = fci->param_count; EG(scope) = calling_scope; if (func->common.fn_flags & ZEND_ACC_STATIC) { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 039020943a..d9f6f3ef69 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2736,8 +2736,9 @@ ZEND_VM_HANDLER(61, ZEND_INIT_FCALL, ANY, CONST) CACHE_PTR(Z_CACHE_SLOT_P(fname), fbc); } - EX(call) = zend_vm_stack_push_call_frame_ex(ZEND_CALL_NESTED_FUNCTION, - fbc, opline->op1.num, NULL, NULL, EX(call)); + EX(call) = zend_vm_stack_push_call_frame_ex( + opline->op1.num, ZEND_CALL_NESTED_FUNCTION, + fbc, opline->extended_value, NULL, NULL, EX(call)); FREE_OP2(); @@ -3126,8 +3127,7 @@ ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, ANY) SAVE_OPLINE(); value = GET_OP1_ZVAL_PTR(BP_VAR_R); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, value); if (OP1_TYPE == IS_CONST) { if (UNEXPECTED(Z_OPT_COPYABLE_P(arg))) { @@ -3148,8 +3148,7 @@ ZEND_VM_HANDLER(116, ZEND_SEND_VAL_EX, CONST|TMP, ANY) zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num); } value = GET_OP1_ZVAL_PTR(BP_VAR_R); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, value); if (OP1_TYPE == IS_CONST) { if (UNEXPECTED(Z_OPT_COPYABLE_P(arg))) { @@ -3166,8 +3165,7 @@ ZEND_VM_HANDLER(117, ZEND_SEND_VAR, VAR|CV, ANY) zend_free_op free_op1; varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (Z_ISREF_P(varptr)) { ZVAL_COPY(arg, Z_REFVAL_P(varptr)); FREE_OP1(); @@ -3211,8 +3209,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) } } - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, varptr); CHECK_EXCEPTION(); @@ -3232,8 +3229,7 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY) zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); } - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (OP1_TYPE == IS_VAR && UNEXPECTED(varptr == &EG(error_zval))) { ZVAL_NEW_REF(arg, &EG(uninitialized_zval)); ZEND_VM_NEXT_OPCODE(); @@ -3265,8 +3261,7 @@ ZEND_VM_HANDLER(66, ZEND_SEND_VAR_EX, VAR|CV, ANY) ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_REF); } varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (Z_ISREF_P(varptr)) { ZVAL_COPY(arg, Z_REFVAL_P(varptr)); FREE_OP1(); @@ -3477,7 +3472,6 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY) zval *arg, *param, tmp; ZEND_VM_C_LABEL(send_array): - arg_num = 1; ht = Z_ARRVAL_P(args); zend_vm_stack_extend_call_frame(&EX(call), 0, zend_hash_num_elements(ht)); @@ -3487,7 +3481,7 @@ ZEND_VM_C_LABEL(send_array): /* check if any of arguments are going to be passed by reference */ for (i = 0; i < zend_hash_num_elements(ht); i++) { - if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num + i)) { + if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, i)) { separate = 1; break; } @@ -3498,7 +3492,8 @@ ZEND_VM_C_LABEL(send_array): } } - param = ZEND_CALL_ARG(EX(call), arg_num); + arg_num = 1; + param = ZEND_CALL_ARG(EX(call), 1); ZEND_HASH_FOREACH_VAL(ht, arg) { if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) { // TODO: Scalar values don't have reference counters anymore. @@ -3577,7 +3572,7 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, ANY) zend_free_op free_op1; arg = GET_OP1_ZVAL_PTR(BP_VAR_R); - param = ZEND_CALL_ARG(EX(call), opline->op2.num); + param = ZEND_CALL_VAR(EX(call), opline->result.var); if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) { // TODO: Scalar values don't have reference counters anymore. @@ -3642,8 +3637,6 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, ANY) ZVAL_COPY(param, arg); } - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; - FREE_OP1(); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -5670,11 +5663,86 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } } - if (EX(call)) { + if (UNEXPECTED(EX(call))) { zend_execute_data *call = EX(call); + zend_op *opline = EX(func)->op_array.opcodes + op_num; + int level; + int do_exit; + do { /* If the exception was thrown during a function call there might be * arguments pushed to the stack that have to be dtor'ed. */ + + /* find the number of actually passed arguments */ + level = 0; + do_exit = 0; + do { + switch (opline->opcode) { + case ZEND_DO_FCALL: + level++; + break; + case ZEND_INIT_FCALL: + case ZEND_INIT_FCALL_BY_NAME: + case ZEND_INIT_NS_FCALL_BY_NAME: + case ZEND_INIT_USER_CALL: + case ZEND_INIT_METHOD_CALL: + case ZEND_INIT_STATIC_METHOD_CALL: + case ZEND_NEW: + if (level == 0) { + ZEND_CALL_NUM_ARGS(call) = 0; + do_exit = 1; + } + level--; + break; + case ZEND_SEND_VAL: + case ZEND_SEND_VAL_EX: + case ZEND_SEND_VAR: + case ZEND_SEND_VAR_EX: + case ZEND_SEND_REF: + case ZEND_SEND_VAR_NO_REF: + case ZEND_SEND_USER: + if (level == 0) { + ZEND_CALL_NUM_ARGS(call) = opline->op2.num; + do_exit = 1; + } + break; + case ZEND_SEND_ARRAY: + case ZEND_SEND_UNPACK: + if (level == 0) { + do_exit = 1; + } + break; + } + if (!do_exit) { + opline--; + } + } while (!do_exit); + if (call->prev_execute_data) { + /* skip current call region */ + level = 0; + do_exit = 0; + do { + switch (opline->opcode) { + case ZEND_DO_FCALL: + level++; + break; + case ZEND_INIT_FCALL: + case ZEND_INIT_FCALL_BY_NAME: + case ZEND_INIT_NS_FCALL_BY_NAME: + case ZEND_INIT_USER_CALL: + case ZEND_INIT_METHOD_CALL: + case ZEND_INIT_STATIC_METHOD_CALL: + case ZEND_NEW: + if (level == 0) { + do_exit = 1; + } + level--; + break; + } + opline--; + } while (!do_exit); + } + zend_vm_stack_free_args(EX(call)); if (Z_OBJ(call->This)) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 5b1d22edcc..1c2700e3b5 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -879,7 +879,6 @@ static int ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *arg, *param, tmp; send_array: - arg_num = 1; ht = Z_ARRVAL_P(args); zend_vm_stack_extend_call_frame(&EX(call), 0, zend_hash_num_elements(ht)); @@ -889,7 +888,7 @@ send_array: /* check if any of arguments are going to be passed by reference */ for (i = 0; i < zend_hash_num_elements(ht); i++) { - if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num + i)) { + if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, i)) { separate = 1; break; } @@ -900,7 +899,8 @@ send_array: } } - param = ZEND_CALL_ARG(EX(call), arg_num); + arg_num = 1; + param = ZEND_CALL_ARG(EX(call), 1); ZEND_HASH_FOREACH_VAL(ht, arg) { if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) { // TODO: Scalar values don't have reference counters anymore. @@ -1231,11 +1231,86 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER } } - if (EX(call)) { + if (UNEXPECTED(EX(call))) { zend_execute_data *call = EX(call); + zend_op *opline = EX(func)->op_array.opcodes + op_num; + int level; + int do_exit; + do { /* If the exception was thrown during a function call there might be * arguments pushed to the stack that have to be dtor'ed. */ + + /* find the number of actually passed arguments */ + level = 0; + do_exit = 0; + do { + switch (opline->opcode) { + case ZEND_DO_FCALL: + level++; + break; + case ZEND_INIT_FCALL: + case ZEND_INIT_FCALL_BY_NAME: + case ZEND_INIT_NS_FCALL_BY_NAME: + case ZEND_INIT_USER_CALL: + case ZEND_INIT_METHOD_CALL: + case ZEND_INIT_STATIC_METHOD_CALL: + case ZEND_NEW: + if (level == 0) { + ZEND_CALL_NUM_ARGS(call) = 0; + do_exit = 1; + } + level--; + break; + case ZEND_SEND_VAL: + case ZEND_SEND_VAL_EX: + case ZEND_SEND_VAR: + case ZEND_SEND_VAR_EX: + case ZEND_SEND_REF: + case ZEND_SEND_VAR_NO_REF: + case ZEND_SEND_USER: + if (level == 0) { + ZEND_CALL_NUM_ARGS(call) = opline->op2.num; + do_exit = 1; + } + break; + case ZEND_SEND_ARRAY: + case ZEND_SEND_UNPACK: + if (level == 0) { + do_exit = 1; + } + break; + } + if (!do_exit) { + opline--; + } + } while (!do_exit); + if (call->prev_execute_data) { + /* skip current call region */ + level = 0; + do_exit = 0; + do { + switch (opline->opcode) { + case ZEND_DO_FCALL: + level++; + break; + case ZEND_INIT_FCALL: + case ZEND_INIT_FCALL_BY_NAME: + case ZEND_INIT_NS_FCALL_BY_NAME: + case ZEND_INIT_USER_CALL: + case ZEND_INIT_METHOD_CALL: + case ZEND_INIT_STATIC_METHOD_CALL: + case ZEND_NEW: + if (level == 0) { + do_exit = 1; + } + level--; + break; + } + opline--; + } while (!do_exit); + } + zend_vm_stack_free_args(EX(call)); if (Z_OBJ(call->This)) { @@ -1656,8 +1731,9 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER CACHE_PTR(Z_CACHE_SLOT_P(fname), fbc); } - EX(call) = zend_vm_stack_push_call_frame_ex(ZEND_CALL_NESTED_FUNCTION, - fbc, opline->op1.num, NULL, NULL, EX(call)); + EX(call) = zend_vm_stack_push_call_frame_ex( + opline->op1.num, ZEND_CALL_NESTED_FUNCTION, + fbc, opline->extended_value, NULL, NULL, EX(call)); ZEND_VM_NEXT_OPCODE(); } @@ -2559,8 +2635,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A SAVE_OPLINE(); value = EX_CONSTANT(opline->op1); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, value); if (IS_CONST == IS_CONST) { if (UNEXPECTED(Z_OPT_COPYABLE_P(arg))) { @@ -2581,8 +2656,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num); } value = EX_CONSTANT(opline->op1); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, value); if (IS_CONST == IS_CONST) { if (UNEXPECTED(Z_OPT_COPYABLE_P(arg))) { @@ -8571,8 +8645,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG SAVE_OPLINE(); value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, value); if (IS_TMP_VAR == IS_CONST) { if (UNEXPECTED(Z_OPT_COPYABLE_P(arg))) { @@ -8593,8 +8666,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num); } value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, value); if (IS_TMP_VAR == IS_CONST) { if (UNEXPECTED(Z_OPT_COPYABLE_P(arg))) { @@ -11150,8 +11222,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_free_op free_op1; varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (Z_ISREF_P(varptr)) { ZVAL_COPY(arg, Z_REFVAL_P(varptr)); zval_ptr_dtor_nogc(free_op1); @@ -11195,8 +11266,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND } } - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, varptr); CHECK_EXCEPTION(); @@ -11216,8 +11286,7 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); } - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (IS_VAR == IS_VAR && UNEXPECTED(varptr == &EG(error_zval))) { ZVAL_NEW_REF(arg, &EG(uninitialized_zval)); ZEND_VM_NEXT_OPCODE(); @@ -11249,8 +11318,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ return ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (Z_ISREF_P(varptr)) { ZVAL_COPY(arg, Z_REFVAL_P(varptr)); zval_ptr_dtor_nogc(free_op1); @@ -11270,7 +11338,7 @@ static int ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR zend_free_op free_op1; arg = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1); - param = ZEND_CALL_ARG(EX(call), opline->op2.num); + param = ZEND_CALL_VAR(EX(call), opline->result.var); if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) { // TODO: Scalar values don't have reference counters anymore. @@ -11335,8 +11403,6 @@ static int ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR ZVAL_COPY(param, arg); } - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; - zval_ptr_dtor_nogc(free_op1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -23262,8 +23328,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (Z_ISREF_P(varptr)) { ZVAL_COPY(arg, Z_REFVAL_P(varptr)); @@ -23307,8 +23372,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL } } - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); ZVAL_COPY_VALUE(arg, varptr); CHECK_EXCEPTION(); @@ -23328,8 +23392,7 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); } - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (IS_CV == IS_VAR && UNEXPECTED(varptr == &EG(error_zval))) { ZVAL_NEW_REF(arg, &EG(uninitialized_zval)); ZEND_VM_NEXT_OPCODE(); @@ -23360,8 +23423,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A return ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var); - arg = ZEND_CALL_ARG(EX(call), opline->op2.num); - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; + arg = ZEND_CALL_VAR(EX(call), opline->result.var); if (Z_ISREF_P(varptr)) { ZVAL_COPY(arg, Z_REFVAL_P(varptr)); @@ -23381,7 +23443,7 @@ static int ZEND_FASTCALL ZEND_SEND_USER_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG arg = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var); - param = ZEND_CALL_ARG(EX(call), opline->op2.num); + param = ZEND_CALL_VAR(EX(call), opline->result.var); if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) { // TODO: Scalar values don't have reference counters anymore. @@ -23445,8 +23507,6 @@ static int ZEND_FASTCALL ZEND_SEND_USER_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG ZVAL_COPY(param, arg); } - ZEND_CALL_NUM_ARGS(EX(call)) = opline->op2.num; - CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 0555f596a9..9ca197eb54 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1561,7 +1561,7 @@ static PHP_FUNCTION(preg_split) /* Get function parameters and do error checking */ #ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|ll", ®ex, - &subject, &subject_len, &limit_val, &flags) == FAILURE) { + &subject, &limit_val, &flags) == FAILURE) { RETURN_FALSE; } #else |