From: Marcus Boerger Date: Sun, 9 Oct 2005 17:14:15 +0000 (+0000) Subject: - Add 'overwrites' info to method dump X-Git-Tag: RELEASE_0_9_1~181 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4190c05133010c052f4f4ce791d5e463e4d9b24;p=php - Add 'overwrites' info to method dump # Right now we have to compute that information because it is not available --- diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index bf495220ec..9e418ecdcd 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -639,6 +639,9 @@ static void _function_parameter_string(string *str, zend_function *fptr, char* i static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, char* indent TSRMLS_DC) { string param_indent; + zend_function *overwrites; + char *lc_name; + unsigned int lc_name_len; /* TBD: Repair indenting of doc comment (or is this to be done in the parser?) * What's "wrong" is that any whitespace before the doc comment start is @@ -653,8 +656,18 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry if (fptr->type == ZEND_INTERNAL_FUNCTION && ((zend_internal_function*)fptr)->module) { string_printf(str, ":%s", ((zend_internal_function*)fptr)->module->name); } - if (scope && fptr->common.scope && fptr->common.scope != scope) { - string_printf(str, ", inherits %v", fptr->common.scope->name); + if (scope && fptr->common.scope) { + if (fptr->common.scope != scope) { + string_printf(str, ", inherits %v", fptr->common.scope->name); + } else if (fptr->common.scope->parent) { + lc_name = zend_u_str_case_fold(IS_STRING, fptr->common.function_name, strlen(fptr->common.function_name), 1, &lc_name_len); + if (zend_u_hash_find(&fptr->common.scope->parent->function_table, IS_STRING, lc_name, lc_name_len + 1, (void**) &overwrites) == SUCCESS) { + if (fptr->common.scope != overwrites->common.scope) { + string_printf(str, ", overwrites %v", overwrites->common.scope->name); + } + } + efree(lc_name); + } } if (fptr->common.prototype && fptr->common.prototype->common.scope) { string_printf(str, ", prototype %v", fptr->common.prototype->common.scope->name); diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index bf495220ec..9e418ecdcd 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -639,6 +639,9 @@ static void _function_parameter_string(string *str, zend_function *fptr, char* i static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, char* indent TSRMLS_DC) { string param_indent; + zend_function *overwrites; + char *lc_name; + unsigned int lc_name_len; /* TBD: Repair indenting of doc comment (or is this to be done in the parser?) * What's "wrong" is that any whitespace before the doc comment start is @@ -653,8 +656,18 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry if (fptr->type == ZEND_INTERNAL_FUNCTION && ((zend_internal_function*)fptr)->module) { string_printf(str, ":%s", ((zend_internal_function*)fptr)->module->name); } - if (scope && fptr->common.scope && fptr->common.scope != scope) { - string_printf(str, ", inherits %v", fptr->common.scope->name); + if (scope && fptr->common.scope) { + if (fptr->common.scope != scope) { + string_printf(str, ", inherits %v", fptr->common.scope->name); + } else if (fptr->common.scope->parent) { + lc_name = zend_u_str_case_fold(IS_STRING, fptr->common.function_name, strlen(fptr->common.function_name), 1, &lc_name_len); + if (zend_u_hash_find(&fptr->common.scope->parent->function_table, IS_STRING, lc_name, lc_name_len + 1, (void**) &overwrites) == SUCCESS) { + if (fptr->common.scope != overwrites->common.scope) { + string_printf(str, ", overwrites %v", overwrites->common.scope->name); + } + } + efree(lc_name); + } } if (fptr->common.prototype && fptr->common.prototype->common.scope) { string_printf(str, ", prototype %v", fptr->common.prototype->common.scope->name);