From 6d6d52551eab974cf3a09367a836ae24de918af2 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Mon, 3 Jul 2000 19:17:57 +0000 Subject: [PATCH] - Fix bug #4120 --- Zend/zend_compile.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index edde8746e9..abfc8d3723 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -823,10 +823,19 @@ void do_begin_dynamic_function_call(znode *function_name CLS_DC) { unsigned char *ptr = NULL; int last_op_number = get_next_op_number(CG(active_op_array))-1; - - if (last_op_number>=0 && CG(active_op_array)->opcodes[last_op_number].opcode == ZEND_FETCH_OBJ_R) { - CG(active_op_array)->opcodes[last_op_number].opcode = ZEND_INIT_FCALL_BY_NAME; - CG(active_op_array)->opcodes[last_op_number].extended_value = ZEND_MEMBER_FUNC_CALL; + zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number]; + + if ((last_op_number >= 1) && (last_op->opcode == ZEND_EXT_FCALL_BEGIN) && ((last_op-1)->opcode == ZEND_FETCH_OBJ_R)) { + zend_op tmp; + + tmp = *last_op; + *last_op = *(last_op-1); + *(last_op-1) = tmp; + last_op->opcode = ZEND_INIT_FCALL_BY_NAME; + last_op->extended_value = ZEND_MEMBER_FUNC_CALL; + } else if (last_op_number>=0 && last_op->opcode == ZEND_FETCH_OBJ_R) { + last_op->opcode = ZEND_INIT_FCALL_BY_NAME; + last_op->extended_value = ZEND_MEMBER_FUNC_CALL; } else { zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); -- 2.40.0