Skip to content

Commit ed59fa3

Browse files
committed
Fixed bug #68103 Dupplicate entry in Reflection (merged)
2 parents bd76544 + d193569 commit ed59fa3

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

ext/reflection/php_reflection.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -995,9 +995,12 @@ static int _extension_class_string(zval *el TSRMLS_DC, int num_args, va_list arg
995995
int *num_classes = va_arg(args, int*);
996996

997997
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module && !strcasecmp(ce->info.internal.module->name, module->name)) {
998-
string_printf(str, "\n");
999-
_class_string(str, ce, NULL, indent TSRMLS_CC);
1000-
(*num_classes)++;
998+
/* dump class if it is not an alias */
999+
if (!zend_binary_strcasecmp(ce->name->val, ce->name->len, hash_key->key->val, hash_key->key->len)) {
1000+
string_printf(str, "\n");
1001+
_class_string(str, ce, NULL, indent TSRMLS_CC);
1002+
(*num_classes)++;
1003+
}
10011004
}
10021005
return ZEND_HASH_APPLY_KEEP;
10031006
}
@@ -5320,11 +5323,20 @@ static int add_extension_class(zval *zv TSRMLS_DC, int num_args, va_list args, z
53205323
int add_reflection_class = va_arg(args, int);
53215324

53225325
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module && !strcasecmp(ce->info.internal.module->name, module->name)) {
5326+
zend_string *name;
5327+
5328+
if (zend_binary_strcasecmp(ce->name->val, ce->name->len, hash_key->key->val, hash_key->key->len)) {
5329+
/* This is an class alias, use alias name */
5330+
name = hash_key->key;
5331+
} else {
5332+
/* Use class name */
5333+
name = ce->name;
5334+
}
53235335
if (add_reflection_class) {
53245336
zend_reflection_class_factory(ce, &zclass TSRMLS_CC);
5325-
zend_hash_update(Z_ARRVAL_P(class_array), ce->name, &zclass);
5337+
zend_hash_update(Z_ARRVAL_P(class_array), name, &zclass);
53265338
} else {
5327-
add_next_index_str(class_array, zend_string_copy(ce->name));
5339+
add_next_index_str(class_array, zend_string_copy(name));
53285340
}
53295341
}
53305342
return ZEND_HASH_APPLY_KEEP;

0 commit comments

Comments
 (0)