cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_language_parser.y

From: Date: Thu, 16 Sep 2004 00:40:38 +0000
Subject: cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_language_parser.y
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2981@lists.php.net to get a copy of this message
andi Wed Sep 15 20:40:38 2004 EDT Modified files: /ZendEngine2 zend_compile.c zend_compile.h zend_language_parser.y Log: - Fix bug #27669 (Dmitry). Fixes: <? class A { function hello() { echo "Hello World\n"; } } $y[0] = 'hello'; A::$y[0](); ?> http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.590&r2=1.591&ty=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.590 ZendEngine2/zend_compile.c:1.591 --- ZendEngine2/zend_compile.c:1.590 Fri Sep 10 02:13:13 2004 +++ ZendEngine2/zend_compile.c Wed Sep 15 20:40:38 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.590 2004/09/10 06:13:13 andi Exp $ */ +/* $Id: zend_compile.c,v 1.591 2004/09/16 00:40:38 andi Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -1311,36 +1311,27 @@ result->u.constant.value.str.len = length; } -void zend_do_begin_class_member_function_call(TSRMLS_D) +void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC) { unsigned char *ptr = NULL; - long fetch_const_op_number = get_next_op_number(CG(active_op_array)); - zend_op *last_op = &CG(active_op_array)->opcodes[fetch_const_op_number-1]; + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - if (last_op->opcode == ZEND_FETCH_CONSTANT) { /* regular method call */ - /* a tmp var is leaked here */ - last_op->opcode = ZEND_INIT_STATIC_METHOD_CALL; - if(last_op->op2.op_type == IS_CONST && - (sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(last_op->op2.u.constant) && - memcmp(Z_STRVAL(last_op->op2.u.constant), ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) { - zval_dtor(&last_op->op2.u.constant); - SET_UNUSED(last_op->op2); + opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; + opline->op1 = *class_name; + opline->op2 = *method_name; + + if (opline->op2.op_type == IS_CONST) { + if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(opline->op2.u.constant) && + memcmp(Z_STRVAL(opline->op2.u.constant), ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) { + zval_dtor(&opline->op2.u.constant); + SET_UNUSED(opline->op2); } else { - zend_lowercase_znode_if_const(&last_op->op2); + zend_str_tolower(opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len); } - } else if (last_op->opcode == ZEND_FETCH_R) { /* indirect method call */ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - last_op->op2.u.EA.type = ZEND_FETCH_LOCAL; - opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; - opline->op1 = last_op->op2; - opline->op2 = last_op->result; - } else { - zend_error(E_COMPILE_ERROR, "Internal compiler error - please report!"); } - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); + zend_do_extended_fcall_begin(TSRMLS_C); } http://cvs.php.net/diff.php/ZendEngine2/zend_compile.h?r1=1.291&r2=1.292&ty=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.291 ZendEngine2/zend_compile.h:1.292 --- ZendEngine2/zend_compile.h:1.291 Thu Sep 9 12:47:22 2004 +++ ZendEngine2/zend_compile.h Wed Sep 15 20:40:38 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.291 2004/09/09 16:47:22 andi Exp $ */ +/* $Id: zend_compile.h,v 1.292 2004/09/16 00:40:38 andi Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -374,7 +374,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC); void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC); void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name TSRMLS_DC); -void zend_do_begin_class_member_function_call(TSRMLS_D); +void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC); void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); void zend_do_handle_exception(TSRMLS_D); http://cvs.php.net/diff.php/ZendEngine2/zend_language_parser.y?r1=1.148&r2=1.149&ty=u Index: ZendEngine2/zend_language_parser.y diff -u ZendEngine2/zend_language_parser.y:1.148 ZendEngine2/zend_language_parser.y:1.149 --- ZendEngine2/zend_language_parser.y:1.148 Mon Aug 2 12:38:09 2004 +++ ZendEngine2/zend_language_parser.y Wed Sep 15 20:40:38 2004 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_parser.y,v 1.148 2004/08/02 16:38:09 helly Exp $ */ +/* $Id: zend_language_parser.y,v 1.149 2004/09/16 00:40:38 andi Exp $ */ /* * LALR shift/reduce conflicts and how they are resolved: @@ -614,12 +614,12 @@ T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } - | class_constant '(' { zend_do_begin_class_member_function_call(TSRMLS_C); zend_do_extended_fcall_begin(TSRMLS_C); } + | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_C); } function_call_parameter_list - ')' { zend_do_end_function_call(NULL, &$$, &$4, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | static_member '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(TSRMLS_C); zend_do_extended_fcall_begin(TSRMLS_C); } + ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_C); } function_call_parameter_list - ')' { zend_do_end_function_call(NULL, &$$, &$4, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} | variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}

« previous php.zend-engine.cvs (#2981) next »