@@ -1541,6 +1541,13 @@ ZEND_FUNCTION(restore_exception_handler)
15411541}
15421542/* }}} */
15431543
1544+ static int same_name (const char * key , const char * name , zend_uint name_len )
1545+ {
1546+ char * lcname = zend_str_tolower_dup (name , name_len );
1547+ int ret = memcmp (lcname , key , name_len ) == 0 ;
1548+ efree (lcname );
1549+ return ret ;
1550+ }
15441551
15451552static int copy_class_or_interface_name (zend_class_entry * * pce TSRMLS_DC , int num_args , va_list args , zend_hash_key * hash_key )
15461553{
@@ -1552,7 +1559,13 @@ static int copy_class_or_interface_name(zend_class_entry **pce TSRMLS_DC, int nu
15521559
15531560 if ((hash_key -> nKeyLength == 0 || hash_key -> arKey [0 ]!= 0 )
15541561 && (comply_mask == (ce -> ce_flags & mask ))) {
1555- add_next_index_stringl (array , ce -> name , ce -> name_length , 1 );
1562+ if (ce -> refcount > 1 &&
1563+ (ce -> name_length != hash_key -> nKeyLength - 1 ||
1564+ !same_name (hash_key -> arKey , ce -> name , ce -> name_length ))) {
1565+ add_next_index_stringl (array , hash_key -> arKey , hash_key -> nKeyLength - 1 , 1 );
1566+ } else {
1567+ add_next_index_stringl (array , ce -> name , ce -> name_length , 1 );
1568+ }
15561569 }
15571570 return ZEND_HASH_APPLY_KEEP ;
15581571}
0 commit comments