@@ -1625,6 +1625,13 @@ ZEND_FUNCTION(restore_exception_handler)
1625
1625
}
1626
1626
/* }}} */
1627
1627
1628
+ static int same_name (const char * key , const char * name , zend_uint name_len )
1629
+ {
1630
+ char * lcname = zend_str_tolower_dup (name , name_len );
1631
+ int ret = memcmp (lcname , key , name_len ) == 0 ;
1632
+ efree (lcname );
1633
+ return ret ;
1634
+ }
1628
1635
1629
1636
static int copy_class_or_interface_name (zend_class_entry * * pce TSRMLS_DC , int num_args , va_list args , zend_hash_key * hash_key )
1630
1637
{
@@ -1636,7 +1643,13 @@ static int copy_class_or_interface_name(zend_class_entry **pce TSRMLS_DC, int nu
1636
1643
1637
1644
if ((hash_key -> nKeyLength == 0 || hash_key -> arKey [0 ]!= 0 )
1638
1645
&& (comply_mask == (ce -> ce_flags & mask ))) {
1639
- add_next_index_stringl (array , ce -> name , ce -> name_length , 1 );
1646
+ if (ce -> refcount > 1 &&
1647
+ (ce -> name_length != hash_key -> nKeyLength - 1 ||
1648
+ !same_name (hash_key -> arKey , ce -> name , ce -> name_length ))) {
1649
+ add_next_index_stringl (array , hash_key -> arKey , hash_key -> nKeyLength - 1 , 1 );
1650
+ } else {
1651
+ add_next_index_stringl (array , ce -> name , ce -> name_length , 1 );
1652
+ }
1640
1653
}
1641
1654
return ZEND_HASH_APPLY_KEEP ;
1642
1655
}
0 commit comments