summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-02-14 11:28:13 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-02-14 11:47:31 +0100
commit1a5cff334d5f93336f3ee645dd73c9297ed24056 (patch)
tree9e116ae4a6b8ff91529a34656075b42532bccfc5 /ext/reflection/php_reflection.c
parent43a7d95016761787cace63fb52e93e27e123d0cc (diff)
downloadphp-git-1a5cff334d5f93336f3ee645dd73c9297ed24056.tar.gz
Remove bogus ctor checks in get_class_methods() + reflection
Contrary to the comments, these only hide constructors (old or new style) if they a) are inherited b) come from a trait and c) are aliased -- which doesn't make any sense at all.
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 8bfafe7c5a..17737454be 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -474,36 +474,26 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
count = zend_hash_num_elements(&ce->function_table) - count_static_funcs;
if (count > 0) {
zend_function *mptr;
- zend_string *key;
smart_str method_str = {0};
count = 0;
- ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, key, mptr) {
+ ZEND_HASH_FOREACH_PTR(&ce->function_table, mptr) {
if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
- size_t len = ZSTR_LEN(mptr->common.function_name);
-
- /* Do not display old-style inherited constructors */
- if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0
- || mptr->common.scope == ce
- || !key
- || zend_binary_strcasecmp(ZSTR_VAL(key), ZSTR_LEN(key), ZSTR_VAL(mptr->common.function_name), len) == 0)
+ zend_function *closure;
+ /* see if this is a closure */
+ if (obj && is_closure_invoke(ce, mptr->common.function_name)
+ && (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
{
- zend_function *closure;
- /* see if this is a closure */
- if (obj && is_closure_invoke(ce, mptr->common.function_name)
- && (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
- {
- mptr = closure;
- } else {
- closure = NULL;
- }
- smart_str_appendc(&method_str, '\n');
- _function_string(&method_str, mptr, ce, ZSTR_VAL(sub_indent));
- count++;
- _free_function(closure);
+ mptr = closure;
+ } else {
+ closure = NULL;
}
+ smart_str_appendc(&method_str, '\n');
+ _function_string(&method_str, mptr, ce, ZSTR_VAL(sub_indent));
+ count++;
+ _free_function(closure);
}
} ZEND_HASH_FOREACH_END();
smart_str_append_printf(str, "\n%s - Methods [%d] {", indent, count);