From: Marcus Boerger Date: Thu, 23 Sep 2004 18:41:15 +0000 (+0000) Subject: MFH Bugfix # 30209 X-Git-Tag: php-5.0.2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=406847a6cd59777e04f628c4a31594abe5dcbc94;p=php MFH Bugfix # 30209 --- diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index 6e8cd6d534..eb8bf648be 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -2159,7 +2159,7 @@ ZEND_METHOD(reflection_class, getMethod) reflection_object *intern; zend_class_entry *ce; zend_function *mptr; - char *name; + char *name, *lc_name; int name_len; METHOD_NOTSTATIC; @@ -2168,10 +2168,12 @@ ZEND_METHOD(reflection_class, getMethod) } GET_REFLECTION_OBJECT_PTR(ce); - zend_str_tolower(name, name_len); - if (zend_hash_find(&ce->function_table, name, name_len + 1, (void**) &mptr) == SUCCESS) { + lc_name = zend_str_tolower_dup(name, name_len); + if (zend_hash_find(&ce->function_table, lc_name, name_len + 1, (void**) &mptr) == SUCCESS) { reflection_method_factory(ce, mptr, return_value TSRMLS_CC); + efree(lc_name); } else { + efree(lc_name); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %s does not exist", name); return; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6e8cd6d534..eb8bf648be 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2159,7 +2159,7 @@ ZEND_METHOD(reflection_class, getMethod) reflection_object *intern; zend_class_entry *ce; zend_function *mptr; - char *name; + char *name, *lc_name; int name_len; METHOD_NOTSTATIC; @@ -2168,10 +2168,12 @@ ZEND_METHOD(reflection_class, getMethod) } GET_REFLECTION_OBJECT_PTR(ce); - zend_str_tolower(name, name_len); - if (zend_hash_find(&ce->function_table, name, name_len + 1, (void**) &mptr) == SUCCESS) { + lc_name = zend_str_tolower_dup(name, name_len); + if (zend_hash_find(&ce->function_table, lc_name, name_len + 1, (void**) &mptr) == SUCCESS) { reflection_method_factory(ce, mptr, return_value TSRMLS_CC); + efree(lc_name); } else { + efree(lc_name); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %s does not exist", name); return;