cvs: ZendEngine2(PHP_5_3) / zend_compile.c zend_execute_API.c zend_object_handlers.c zend_vm_def.h zend_vm_execute.h /tests call_static.phpt
| From: | Felipe Pena | Date: | Tue, 03 Jun 2008 18:11:14 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_3) / zend_compile.c zend_execute_API.c zend_object_handlers.c zend_vm_def.h zend_vm_execute.h /tests call_static.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-6772@lists.php.net to get a copy of this message | ||
felipe Tue Jun 3 18:11:14 2008 UTC
Modified files: (Branch: PHP_5_3)
/ZendEngine2 zend_compile.c zend_execute_API.c
zend_object_handlers.c zend_vm_def.h zend_vm_execute.h
/ZendEngine2/tests call_static.phpt
Log:
- Fixed bug #45089 (__callStatic $name case sensitivity)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.65&r2=1.647.2.27.2.41.2.66&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.65 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.66 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.65 Tue Jun 3 14:07:15 2008 +++ ZendEngine2/zend_compile.c Tue Jun 3 18:11:11 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.65 2008/06/03 14:07:15 felipe Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.66 2008/06/03 18:11:11 felipe Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1919,11 +1919,8 @@ memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) { zval_dtor(&method_name->u.constant); SET_UNUSED(*method_name); - efree(lcname); - } else { - efree(Z_STRVAL(method_name->u.constant)); - Z_STRVAL(method_name->u.constant) = lcname; } + efree(lcname); } if (class_name->op_type == IS_CONST && http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.40&r2=1.331.2.20.2.24.2.41&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.40 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.41 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.40 Wed May 7 12:04:37 2008 +++ ZendEngine2/zend_execute_API.c Tue Jun 3 18:11:11 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.40 2008/05/07 12:04:37 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.41 2008/06/03 18:11:11 felipe Exp $ */ #include <stdio.h> #include <signal.h> @@ -901,14 +901,11 @@ efree(function_name_lc); } } else if (calling_scope) { - char *function_name_lc = zend_str_tolower_dup(fname, fname_len); - if (calling_scope->get_static_method) { - EX(function_state).function = calling_scope->get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC); + EX(function_state).function = calling_scope->get_static_method(calling_scope, fname, fname_len TSRMLS_CC); } else { - EX(function_state).function = zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC); + EX(function_state).function = zend_std_get_static_method(calling_scope, fname, fname_len TSRMLS_CC); } - efree(function_name_lc); if (check_scope_or_static && EX(function_state).function && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.22.2.16&r2=1.135.2.6.2.22.2.17&diff_format=u Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.22.2.16 ZendEngine2/zend_object_handlers.c:1.135.2.6.2.22.2.17 --- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.22.2.16 Tue May 27 10:29:33 2008 +++ ZendEngine2/zend_object_handlers.c Tue Jun 3 18:11:11 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.135.2.6.2.22.2.16 2008/05/27 10:29:33 mattwil Exp $ */ +/* $Id: zend_object_handlers.c,v 1.135.2.6.2.22.2.17 2008/06/03 18:11:11 felipe Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -893,7 +893,9 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { zend_function *fbc = NULL; - char *lc_class_name; + char *lc_class_name, *lc_function_name = NULL; + + lc_function_name = zend_str_tolower_dup(function_name_strval, function_name_strlen); if (function_name_strlen == ce->name_length && ce->constructor) { lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length); @@ -902,7 +904,9 @@ } efree(lc_class_name); } - if (!fbc && zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) { + if (!fbc && zend_hash_find(&ce->function_table, lc_function_name, function_name_strlen+1, (void **) &fbc)==FAILURE) { + efree(lc_function_name); + if (ce->__call && EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && @@ -940,6 +944,7 @@ zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name ? ce->name : "", function_name_strval); } } + efree(lc_function_name); #if MBO_0 /* right now this function is used for non static method lookup too */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.48.2.56&r2=1.59.2.29.2.48.2.57&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.56 ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.57 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.56 Fri May 16 14:34:31 2008 +++ ZendEngine2/zend_vm_def.h Tue Jun 3 18:11:11 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.56 2008/05/16 14:34:31 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.57 2008/06/03 18:11:11 felipe Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1942,7 +1942,7 @@ } if(OP2_TYPE != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (OP2_TYPE == IS_CONST) { @@ -1953,19 +1953,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (OP2_TYPE != IS_CONST) { - efree(function_name_strval); FREE_OP2(); } } else { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.49.2.56&r2=1.62.2.30.2.49.2.57&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.56 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.57 --- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.56 Fri May 16 14:34:31 2008 +++ ZendEngine2/zend_vm_execute.h Tue Jun 3 18:11:11 2008 @@ -2449,7 +2449,7 @@ } if(IS_CONST != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_CONST == IS_CONST) { @@ -2460,19 +2460,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_CONST != IS_CONST) { - efree(function_name_strval); } } else { @@ -3020,7 +3022,7 @@ } if(IS_TMP_VAR != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { @@ -3031,19 +3033,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_TMP_VAR != IS_CONST) { - efree(function_name_strval); zval_dtor(free_op2.var); } } else { @@ -3486,7 +3490,7 @@ } if(IS_VAR != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { @@ -3497,19 +3501,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_VAR != IS_CONST) { - efree(function_name_strval); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } } else { @@ -3708,7 +3714,7 @@ } if(IS_UNUSED != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { @@ -3719,19 +3725,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_UNUSED != IS_CONST) { - efree(function_name_strval); } } else { @@ -4142,7 +4150,7 @@ } if(IS_CV != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_CV == IS_CONST) { @@ -4153,19 +4161,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_CV != IS_CONST) { - efree(function_name_strval); } } else { @@ -10078,7 +10088,7 @@ } if(IS_CONST != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_CONST == IS_CONST) { @@ -10089,19 +10099,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_CONST != IS_CONST) { - efree(function_name_strval); } } else { @@ -11908,7 +11920,7 @@ } if(IS_TMP_VAR != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { @@ -11919,19 +11931,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_TMP_VAR != IS_CONST) { - efree(function_name_strval); zval_dtor(free_op2.var); } } else { @@ -13708,7 +13722,7 @@ } if(IS_VAR != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { @@ -13719,19 +13733,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_VAR != IS_CONST) { - efree(function_name_strval); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } } else { @@ -14611,7 +14627,7 @@ } if(IS_UNUSED != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { @@ -14622,19 +14638,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_UNUSED != IS_CONST) { - efree(function_name_strval); } } else { @@ -16112,7 +16130,7 @@ } if(IS_CV != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_CV == IS_CONST) { @@ -16123,19 +16141,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_CV != IS_CONST) { - efree(function_name_strval); } } else { http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/call_static.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: ZendEngine2/tests/call_static.phpt diff -u ZendEngine2/tests/call_static.phpt:1.1.2.2 ZendEngine2/tests/call_static.phpt:1.1.2.3 --- ZendEngine2/tests/call_static.phpt:1.1.2.2 Sat Sep 29 08:52:40 2007 +++ ZendEngine2/tests/call_static.phpt Tue Jun 3 18:11:12 2008 @@ -15,6 +15,6 @@ Test::Four(5, 6, 7, 8); --EXPECT-- -two() called with 2 arguments -three() called with 3 arguments -four() called with 4 arguments +Two() called with 2 arguments +Three() called with 3 arguments +Four() called with 4 arguments
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.65&r2=1.647.2.27.2.41.2.66&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.65 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.66 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.65 Tue Jun 3 14:07:15 2008 +++ ZendEngine2/zend_compile.c Tue Jun 3 18:11:11 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.65 2008/06/03 14:07:15 felipe Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.66 2008/06/03 18:11:11 felipe Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1919,11 +1919,8 @@ memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) { zval_dtor(&method_name->u.constant); SET_UNUSED(*method_name); - efree(lcname); - } else { - efree(Z_STRVAL(method_name->u.constant)); - Z_STRVAL(method_name->u.constant) = lcname; } + efree(lcname); } if (class_name->op_type == IS_CONST && http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.40&r2=1.331.2.20.2.24.2.41&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.40 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.41 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.40 Wed May 7 12:04:37 2008 +++ ZendEngine2/zend_execute_API.c Tue Jun 3 18:11:11 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.40 2008/05/07 12:04:37 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.41 2008/06/03 18:11:11 felipe Exp $ */ #include <stdio.h> #include <signal.h> @@ -901,14 +901,11 @@ efree(function_name_lc); } } else if (calling_scope) { - char *function_name_lc = zend_str_tolower_dup(fname, fname_len); - if (calling_scope->get_static_method) { - EX(function_state).function = calling_scope->get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC); + EX(function_state).function = calling_scope->get_static_method(calling_scope, fname, fname_len TSRMLS_CC); } else { - EX(function_state).function = zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC); + EX(function_state).function = zend_std_get_static_method(calling_scope, fname, fname_len TSRMLS_CC); } - efree(function_name_lc); if (check_scope_or_static && EX(function_state).function && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.22.2.16&r2=1.135.2.6.2.22.2.17&diff_format=u Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.22.2.16 ZendEngine2/zend_object_handlers.c:1.135.2.6.2.22.2.17 --- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.22.2.16 Tue May 27 10:29:33 2008 +++ ZendEngine2/zend_object_handlers.c Tue Jun 3 18:11:11 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.135.2.6.2.22.2.16 2008/05/27 10:29:33 mattwil Exp $ */ +/* $Id: zend_object_handlers.c,v 1.135.2.6.2.22.2.17 2008/06/03 18:11:11 felipe Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -893,7 +893,9 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { zend_function *fbc = NULL; - char *lc_class_name; + char *lc_class_name, *lc_function_name = NULL; + + lc_function_name = zend_str_tolower_dup(function_name_strval, function_name_strlen); if (function_name_strlen == ce->name_length && ce->constructor) { lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length); @@ -902,7 +904,9 @@ } efree(lc_class_name); } - if (!fbc && zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) { + if (!fbc && zend_hash_find(&ce->function_table, lc_function_name, function_name_strlen+1, (void **) &fbc)==FAILURE) { + efree(lc_function_name); + if (ce->__call && EG(This) && Z_OBJ_HT_P(EG(This))->get_class_entry && @@ -940,6 +944,7 @@ zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name ? ce->name : "", function_name_strval); } } + efree(lc_function_name); #if MBO_0 /* right now this function is used for non static method lookup too */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.48.2.56&r2=1.59.2.29.2.48.2.57&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.56 ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.57 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.56 Fri May 16 14:34:31 2008 +++ ZendEngine2/zend_vm_def.h Tue Jun 3 18:11:11 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.56 2008/05/16 14:34:31 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.57 2008/06/03 18:11:11 felipe Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1942,7 +1942,7 @@ } if(OP2_TYPE != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (OP2_TYPE == IS_CONST) { @@ -1953,19 +1953,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (OP2_TYPE != IS_CONST) { - efree(function_name_strval); FREE_OP2(); } } else { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.49.2.56&r2=1.62.2.30.2.49.2.57&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.56 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.57 --- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.56 Fri May 16 14:34:31 2008 +++ ZendEngine2/zend_vm_execute.h Tue Jun 3 18:11:11 2008 @@ -2449,7 +2449,7 @@ } if(IS_CONST != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_CONST == IS_CONST) { @@ -2460,19 +2460,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_CONST != IS_CONST) { - efree(function_name_strval); } } else { @@ -3020,7 +3022,7 @@ } if(IS_TMP_VAR != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { @@ -3031,19 +3033,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_TMP_VAR != IS_CONST) { - efree(function_name_strval); zval_dtor(free_op2.var); } } else { @@ -3486,7 +3490,7 @@ } if(IS_VAR != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { @@ -3497,19 +3501,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_VAR != IS_CONST) { - efree(function_name_strval); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } } else { @@ -3708,7 +3714,7 @@ } if(IS_UNUSED != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { @@ -3719,19 +3725,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_UNUSED != IS_CONST) { - efree(function_name_strval); } } else { @@ -4142,7 +4150,7 @@ } if(IS_CV != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_CV == IS_CONST) { @@ -4153,19 +4161,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_CV != IS_CONST) { - efree(function_name_strval); } } else { @@ -10078,7 +10088,7 @@ } if(IS_CONST != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_CONST == IS_CONST) { @@ -10089,19 +10099,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_CONST != IS_CONST) { - efree(function_name_strval); } } else { @@ -11908,7 +11920,7 @@ } if(IS_TMP_VAR != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { @@ -11919,19 +11931,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_TMP_VAR != IS_CONST) { - efree(function_name_strval); zval_dtor(free_op2.var); } } else { @@ -13708,7 +13722,7 @@ } if(IS_VAR != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { @@ -13719,19 +13733,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_VAR != IS_CONST) { - efree(function_name_strval); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } } else { @@ -14611,7 +14627,7 @@ } if(IS_UNUSED != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { @@ -14622,19 +14638,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_UNUSED != IS_CONST) { - efree(function_name_strval); } } else { @@ -16112,7 +16130,7 @@ } if(IS_CV != IS_UNUSED) { char *function_name_strval; - int function_name_strlen; + int function_name_strlen = 0; if (IS_CV == IS_CONST) { @@ -16123,19 +16141,21 @@ if (Z_TYPE_P(function_name) != IS_STRING) { zend_error_noreturn(E_ERROR, "Function name must be a string"); - } - function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len); - function_name_strlen = function_name->value.str.len; + } else { + function_name_strval = Z_STRVAL_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); + } } - if (ce->get_static_method) { - EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - } else { - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + if (function_name_strlen) { + if (ce->get_static_method) { + EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } else { + EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); + } } if (IS_CV != IS_CONST) { - efree(function_name_strval); } } else { http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/call_static.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: ZendEngine2/tests/call_static.phpt diff -u ZendEngine2/tests/call_static.phpt:1.1.2.2 ZendEngine2/tests/call_static.phpt:1.1.2.3 --- ZendEngine2/tests/call_static.phpt:1.1.2.2 Sat Sep 29 08:52:40 2007 +++ ZendEngine2/tests/call_static.phpt Tue Jun 3 18:11:12 2008 @@ -15,6 +15,6 @@ Test::Four(5, 6, 7, 8); --EXPECT-- -two() called with 2 arguments -three() called with 3 arguments -four() called with 4 arguments +Two() called with 2 arguments +Three() called with 3 arguments +Four() called with 4 arguments