Skip to content

Commit 3d631c4

Browse files
author
Andi Gutmans
committed
- Should fix the pass by reference problem. This happened because we moved
start from arg 1 now and not arg 0. There might be more places which need fixing like in the executor but the bug seems OK now.
1 parent fa76f0c commit 3d631c4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Zend/zend_compile.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -657,15 +657,15 @@ void do_receive_arg(int op, znode *var, znode *offset, znode *initialization, un
657657
if (pass_type==BYREF_FORCE && !CG(active_op_array)->arg_types) {
658658
int i;
659659

660-
CG(active_op_array)->arg_types = (unsigned char *) emalloc(sizeof(unsigned char)*(offset->u.constant.value.lval+2));
661-
for (i=1; i<=offset->u.constant.value.lval; i++) {
660+
CG(active_op_array)->arg_types = (unsigned char *) emalloc(sizeof(unsigned char)*(offset->u.constant.value.lval+1));
661+
for (i=1; i<offset->u.constant.value.lval; i++) {
662662
CG(active_op_array)->arg_types[i] = BYREF_NONE;
663663
}
664664
CG(active_op_array)->arg_types[0]=(unsigned char) offset->u.constant.value.lval;
665665
}
666666
if (CG(active_op_array)->arg_types) {
667-
CG(active_op_array)->arg_types = (unsigned char *) erealloc(CG(active_op_array)->arg_types, sizeof(unsigned char)*(offset->u.constant.value.lval+2));
668-
CG(active_op_array)->arg_types[offset->u.constant.value.lval+1] = pass_type;
667+
CG(active_op_array)->arg_types = (unsigned char *) erealloc(CG(active_op_array)->arg_types, sizeof(unsigned char)*(offset->u.constant.value.lval+1));
668+
CG(active_op_array)->arg_types[offset->u.constant.value.lval] = pass_type;
669669
CG(active_op_array)->arg_types[0]++;
670670
}
671671
}

0 commit comments

Comments
 (0)