From 95c73f99d358f42960cdd536c589244abf35174e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 26 Feb 2014 16:25:10 +0100 Subject: Don't add num_additional_args in SEND opcodes Now that trailing positional args are disallowed, num_additional_args will always be zero in SEND opcodes (and FUNC_ARG fetches). --- Zend/zend_vm_def.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'Zend/zend_vm_def.h') diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 713d6fadee..ed353edbac 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3063,9 +3063,8 @@ ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, ANY) SAVE_OPLINE(); if (opline->extended_value == ZEND_DO_FCALL_BY_NAME) { - int arg_num = opline->op2.num + EX(call)->num_additional_args; - if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) { - zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", arg_num); + if (ARG_MUST_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) { + zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num); } } @@ -3126,7 +3125,6 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) USE_OPLINE zend_free_op free_op1; zval *varptr; - int arg_num; SAVE_OPLINE(); if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */ @@ -3134,8 +3132,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); } } else { - arg_num = opline->op2.num + EX(call)->num_additional_args; - if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) { + if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) { ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); } } @@ -3155,7 +3152,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ? !(opline->extended_value & ZEND_ARG_SEND_SILENT) : - !ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) { + !ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) { zend_error(E_STRICT, "Only variables should be passed by reference"); } ALLOC_ZVAL(valptr); @@ -3193,8 +3190,7 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY) if (opline->extended_value == ZEND_DO_FCALL_BY_NAME && EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { - int arg_num = opline->op2.num + EX(call)->num_additional_args; - if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) { + if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) { ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); } } @@ -3214,8 +3210,7 @@ ZEND_VM_HANDLER(66, ZEND_SEND_VAR, VAR|CV, ANY) USE_OPLINE if (opline->extended_value == ZEND_DO_FCALL_BY_NAME) { - int arg_num = opline->op2.num + EX(call)->num_additional_args; - if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) { + if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.num)) { ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_REF); } } -- cgit v1.2.1