@@ -1025,6 +1025,13 @@ ZEND_FUNCTION(get_object_vars)
1025
1025
}
1026
1026
/* }}} */
1027
1027
1028
+ static int same_name (const char * key , const char * name , zend_uint name_len )
1029
+ {
1030
+ char * lcname = zend_str_tolower_dup (name , name_len );
1031
+ int ret = memcmp (lcname , key , name_len ) == 0 ;
1032
+ efree (lcname );
1033
+ return ret ;
1034
+ }
1028
1035
1029
1036
/* {{{ proto array get_class_methods(mixed class)
1030
1037
Returns an array of method names for class or class instance. */
@@ -1072,14 +1079,26 @@ ZEND_FUNCTION(get_class_methods)
1072
1079
uint len = strlen (mptr -> common .function_name );
1073
1080
1074
1081
/* Do not display old-style inherited constructors */
1075
- if ((mptr -> common .fn_flags & ZEND_ACC_CTOR ) == 0 ||
1076
- mptr -> common .scope == ce ||
1077
- zend_hash_get_current_key_ex (& ce -> function_table , & key , & key_len , & num_index , 0 , & pos ) != HASH_KEY_IS_STRING ||
1078
- zend_binary_strcasecmp (key , key_len - 1 , mptr -> common .function_name , len ) == 0 ) {
1079
-
1082
+ if (zend_hash_get_current_key_ex (& ce -> function_table , & key , & key_len , & num_index , 0 , & pos ) != HASH_KEY_IS_STRING ) {
1080
1083
MAKE_STD_ZVAL (method_name );
1081
1084
ZVAL_STRINGL (method_name , mptr -> common .function_name , len , 1 );
1082
1085
zend_hash_next_index_insert (return_value -> value .ht , & method_name , sizeof (zval * ), NULL );
1086
+ } else if ((mptr -> common .fn_flags & ZEND_ACC_CTOR ) == 0 ||
1087
+ mptr -> common .scope == ce ||
1088
+ zend_binary_strcasecmp (key , key_len - 1 , mptr -> common .function_name , len ) == 0 ) {
1089
+
1090
+ if (mptr -> type == ZEND_USER_FUNCTION &&
1091
+ * mptr -> op_array .refcount > 1 &&
1092
+ (len != key_len - 1 ||
1093
+ !same_name (key , mptr -> common .function_name , len ))) {
1094
+ MAKE_STD_ZVAL (method_name );
1095
+ ZVAL_STRINGL (method_name , key , key_len - 1 , 1 );
1096
+ zend_hash_next_index_insert (return_value -> value .ht , & method_name , sizeof (zval * ), NULL );
1097
+ } else {
1098
+ MAKE_STD_ZVAL (method_name );
1099
+ ZVAL_STRINGL (method_name , mptr -> common .function_name , len , 1 );
1100
+ zend_hash_next_index_insert (return_value -> value .ht , & method_name , sizeof (zval * ), NULL );
1101
+ }
1083
1102
}
1084
1103
}
1085
1104
zend_hash_move_forward_ex (& ce -> function_table , & pos );
@@ -1640,14 +1659,6 @@ ZEND_FUNCTION(restore_exception_handler)
1640
1659
}
1641
1660
/* }}} */
1642
1661
1643
- static int same_name (const char * key , const char * name , zend_uint name_len )
1644
- {
1645
- char * lcname = zend_str_tolower_dup (name , name_len );
1646
- int ret = memcmp (lcname , key , name_len ) == 0 ;
1647
- efree (lcname );
1648
- return ret ;
1649
- }
1650
-
1651
1662
static int copy_class_or_interface_name (zend_class_entry * * pce TSRMLS_DC , int num_args , va_list args , zend_hash_key * hash_key )
1652
1663
{
1653
1664
zval * array = va_arg (args , zval * );
0 commit comments