cvs: ZendEngine2(PHP_5_1) / zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /tests bug33257.phpt

From: Date: Mon, 19 Sep 2005 16:02:22 +0000
Subject: cvs: ZendEngine2(PHP_5_1) / zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /tests bug33257.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4143@lists.php.net to get a copy of this message
dmitry Mon Sep 19 12:02:22 2005 EDT Modified files: (Branch: PHP_5_1) /ZendEngine2 zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /ZendEngine2/tests bug33257.phpt Log: Fixed parameter passing incompatibilities. Now it is possible to call array_pop(explode("&","1&2&3")) again.

http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.59.2.7&r2=1.59.2.8&ty=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.7 ZendEngine2/zend_vm_def.h:1.59.2.8 --- ZendEngine2/zend_vm_def.h:1.59.2.7 Fri Sep 16 13:05:09 2005 +++ ZendEngine2/zend_vm_def.h Mon Sep 19 12:02:19 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.7 2005/09/16 17:05:09 tony2001 Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.8 2005/09/19 16:02:19 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -2185,6 +2185,9 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) { zend_op *opline = EX(opline); + zend_free_op free_op1; + zval *varptr; + if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */ if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) { ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); @@ -2192,23 +2195,27 @@ } else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); } - if ((opline->extended_value & ZEND_ARG_SEND_FUNCTION) && - !EX_T(opline->op1.u.var).var.fcall_returned_reference) { - zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); + + varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); + 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->refcount == 1)) { + varptr->is_ref = 1; + varptr->refcount++; + zend_ptr_stack_push(&EG(argument_stack), varptr); } else { - zval *varptr; - zend_free_op free_op1; - varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); + zval *valptr; - if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) { - varptr->is_ref = 1; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); - FREE_OP1_IF_VAR(); - ZEND_VM_NEXT_OPCODE(); + zend_error(E_STRICT, "Only variables should be passed by reference"); + ALLOC_ZVAL(valptr); + INIT_PZVAL_COPY(valptr, varptr); + if (!IS_OP1_TMP_FREE()) { + zval_copy_ctor(valptr); } - zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); + zend_ptr_stack_push(&EG(argument_stack), valptr); } + FREE_OP1_IF_VAR(); ZEND_VM_NEXT_OPCODE(); } http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.62.2.7&r2=1.62.2.8&ty=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.7 ZendEngine2/zend_vm_execute.h:1.62.2.8 --- ZendEngine2/zend_vm_execute.h:1.62.2.7 Fri Sep 16 13:05:09 2005 +++ ZendEngine2/zend_vm_execute.h Mon Sep 19 12:02:20 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_execute.h,v 1.62.2.7 2005/09/16 17:05:09 tony2001 Exp $ */ +/* $Id: zend_vm_execute.h,v 1.62.2.8 2005/09/19 16:02:20 dmitry Exp $ */ static opcode_handler_t zend_user_opcode_handlers[256] = {(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL}; @@ -7093,6 +7093,9 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + zend_free_op free_op1; + zval *varptr; + if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */ if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) { return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); @@ -7100,23 +7103,27 @@ } 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); } - if ((opline->extended_value & ZEND_ARG_SEND_FUNCTION) && - !EX_T(opline->op1.u.var).var.fcall_returned_reference) { - zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); + + 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->refcount == 1)) { + varptr->is_ref = 1; + varptr->refcount++; + zend_ptr_stack_push(&EG(argument_stack), varptr); } else { - zval *varptr; - zend_free_op free_op1; - varptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + zval *valptr; - if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) { - varptr->is_ref = 1; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - ZEND_VM_NEXT_OPCODE(); + zend_error(E_STRICT, "Only variables should be passed by reference"); + ALLOC_ZVAL(valptr); + INIT_PZVAL_COPY(valptr, varptr); + if (!0) { + zval_copy_ctor(valptr); } - zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); + zend_ptr_stack_push(&EG(argument_stack), valptr); } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -19258,6 +19265,9 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); + + zval *varptr; + if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */ if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) { return zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); @@ -19265,23 +19275,27 @@ } 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); } - if ((opline->extended_value & ZEND_ARG_SEND_FUNCTION) && - !EX_T(opline->op1.u.var).var.fcall_returned_reference) { - zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); + + 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->refcount == 1)) { + varptr->is_ref = 1; + varptr->refcount++; + zend_ptr_stack_push(&EG(argument_stack), varptr); } else { - zval *varptr; - - varptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - - if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) { - varptr->is_ref = 1; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); + zval *valptr; - ZEND_VM_NEXT_OPCODE(); + zend_error(E_STRICT, "Only variables should be passed by reference"); + ALLOC_ZVAL(valptr); + INIT_PZVAL_COPY(valptr, varptr); + if (!0) { + zval_copy_ctor(valptr); } - zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); + zend_ptr_stack_push(&EG(argument_stack), valptr); } + ZEND_VM_NEXT_OPCODE(); } http://cvs.php.net/diff.php/ZendEngine2/zend_vm_opcodes.h?r1=1.42.2.5&r2=1.42.2.6&ty=u Index: ZendEngine2/zend_vm_opcodes.h diff -u ZendEngine2/zend_vm_opcodes.h:1.42.2.5 ZendEngine2/zend_vm_opcodes.h:1.42.2.6 --- ZendEngine2/zend_vm_opcodes.h:1.42.2.5 Fri Sep 16 10:42:45 2005 +++ ZendEngine2/zend_vm_opcodes.h Mon Sep 19 12:02:21 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_opcodes.h,v 1.42.2.5 2005/09/16 14:42:45 dmitry Exp $ */ +/* $Id: zend_vm_opcodes.h,v 1.42.2.6 2005/09/19 16:02:21 dmitry Exp $ */ #define ZEND_NOP 0 #define ZEND_ADD 1 http://cvs.php.net/diff.php/ZendEngine2/tests/bug33257.phpt?r1=1.2&r2=1.2.2.1&ty=u Index: ZendEngine2/tests/bug33257.phpt diff -u ZendEngine2/tests/bug33257.phpt:1.2 ZendEngine2/tests/bug33257.phpt:1.2.2.1 --- ZendEngine2/tests/bug33257.phpt:1.2 Wed Jun 22 04:33:00 2005 +++ ZendEngine2/tests/bug33257.phpt Mon Sep 19 12:02:21 2005 @@ -14,4 +14,10 @@ print_r(X::getArr()); ?> --EXPECTF-- -Fatal error: Only variables can be passed by reference in %sbug33257.php on line 10 +Strict Standards: Only variables should be passed by reference in %sbug33257.php on line 10 +Array +( + [0] => a + [1] => b + [2] => c +)
« previous php.zend-engine.cvs (#4143) next »