From: Andi Gutmans Date: Wed, 5 Jun 2002 17:34:56 +0000 (+0000) Subject: - Allow overloaded objects to receive the method name in its original X-Git-Tag: RELEASE_0_90~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d6404d5b0e998ef21d99cd24265a6cb209e6c87;p=php - Allow overloaded objects to receive the method name in its original - case. --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index acc1d20cbb..325025d95c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1081,8 +1081,6 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) last_op->extended_value = ZEND_FETCH_FROM_THIS; } - zend_lowercase_znode_if_const(&last_op->op2); - left_bracket->u.constant.value.lval = ZEND_INIT_FCALL_BY_NAME; zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 4fa0d3b302..4457ea6aaa 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1892,30 +1892,15 @@ binary_assign_op_addr_obj: { zval *function_name; zval tmp; - zend_bool is_const; char *function_name_strval; int function_name_strlen; zend_ptr_stack_n_push(&EG(arg_types_stack), 2, EX(fbc), EX(object)); - is_const = (EX(opline)->op2.op_type == IS_CONST); - - if (is_const) { - function_name_strval = EX(opline)->op2.u.constant.value.str.val; - function_name_strlen = EX(opline)->op2.u.constant.value.str.len; - } else { - function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - - tmp = *function_name; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - function_name = &tmp; - zend_str_tolower(tmp.value.str.val, tmp.value.str.len); + function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); + function_name_strval = function_name->value.str.val; + function_name_strlen = function_name->value.str.len; - function_name_strval = tmp.value.str.val; - function_name_strlen = tmp.value.str.len; - } - EX(calling_scope) = EG(scope); if (EX(opline)->extended_value == ZEND_FETCH_FROM_THIS) { @@ -1953,10 +1938,7 @@ binary_assign_op_addr_obj: EX(calling_scope) = NULL; } - if (!is_const) { - zval_dtor(&tmp); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - } + FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); NEXT_OPCODE(); } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 55a4073bf6..b27eeed078 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -152,12 +152,19 @@ static union _zend_function *zend_std_get_method(zval *object, char *method_name { zend_object *zobj; zend_function *func_method; - + char *lc_method_name; + + lc_method_name = do_alloca(method_len+1); + /* Create a zend_copy_str_tolower(dest, src, src_length); */ + memcpy(lc_method_name, method_name, method_len+1); + zend_str_tolower(lc_method_name, method_len); + zobj = Z_OBJ_P(object); - if(zend_hash_find(&zobj->ce->function_table, method_name, method_len+1, (void **)&func_method) == FAILURE) { + if(zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&func_method) == FAILURE) { zend_error(E_ERROR, "Call to undefined function %s()", method_name); } - + + free_alloca(lc_method_name); return func_method; }