arg_types = NULL;
}
- if (op == ZEND_SEND_VAL) {
+ if (op==ZEND_SEND_VAL) {
switch (param->op_type) {
case IS_CONST: /* constants behave like variables when passed to functions,
* as far as reference counting is concerned. Treat them
* as if they were variables here.
*/
case IS_VAR:
- op = ZEND_SEND_VAR;
+ op = ZEND_SEND_VAR_NO_REF;
break;
}
}
-
-
- if (ARG_SHOULD_BE_SENT_BY_REF(offset, 1, arg_types)) {
+ if (op!=ZEND_SEND_VAR_NO_REF
+ && ARG_SHOULD_BE_SENT_BY_REF(offset, 1, arg_types)) {
/* change to passing by reference */
switch (param->op_type) {
case IS_VAR:
if (original_op==ZEND_SEND_VAR) {
switch(op) {
+ case ZEND_SEND_VAR_NO_REF:
case ZEND_SEND_VAR:
if (function_ptr) {
do_end_variable_parse(BP_VAR_R, 0 CLS_CC);
}
NEXT_OPCODE();
case ZEND_SEND_VAR:
+ case ZEND_SEND_VAR_NO_REF:
if (opline->extended_value==ZEND_DO_FCALL_BY_NAME
&& ARG_SHOULD_BE_SENT_BY_REF(opline->op2.u.opline_num, fbc, fbc->common.arg_types)) {
- goto send_by_ref;
+ if (opline->opcode==ZEND_SEND_VAR_NO_REF) {
+ zend_error(E_ERROR, "Only variables can be passed by reference");
+ }
+ goto send_by_ref;
}
{
zval *varptr;