@@ -1180,57 +1180,29 @@ static zend_string *zend_resolve_const_name(zend_string *name, uint32_t type, bo
1180
1180
name , type , is_fully_qualified , 1 , FC (imports_const ));
1181
1181
}
1182
1182
1183
- static zend_string * get_namespace_from_scope (const zend_class_entry * scope )
1184
- {
1185
- ZEND_ASSERT (scope != NULL );
1186
- while (scope && scope -> lexical_scope && scope -> type != ZEND_NAMESPACE_CLASS ) {
1187
- scope = scope -> lexical_scope ;
1188
- }
1189
- return zend_string_copy (scope -> name );
1190
- }
1191
-
1192
- static zend_string * get_scoped_name (zend_string * ns , zend_string * name )
1193
- {
1194
- name = zend_string_tolower (name );
1195
- if (ns && ZSTR_LEN (ns ) && ZSTR_LEN (name ) > ZSTR_LEN (ns ) + 1 &&
1196
- memcmp (ZSTR_VAL (name ), ZSTR_VAL (ns ), ZSTR_LEN (ns )) == 0 &&
1197
- ZSTR_VAL (name )[ZSTR_LEN (ns )] == '\\' ) {
1198
- zend_string * ret = zend_string_init (ZSTR_VAL (name ) + ZSTR_LEN (ns ) + 1 , ZSTR_LEN (name ) - ZSTR_LEN (ns ) - 1 , 0 );
1199
- zend_string_release (name );
1200
- return ret ;
1201
- }
1202
- return name ;
1203
- }
1204
-
1205
1183
zend_string * zend_resolve_class_in_scope (zend_string * name , const zend_class_entry * scope )
1206
1184
{
1207
- zend_string * ns_name = get_namespace_from_scope (scope );
1208
- zend_string * original_suffix = get_scoped_name (ns_name , name );
1209
- zend_string_release (ns_name );
1210
-
1211
1185
const zend_class_entry * current_scope = scope ;
1212
1186
1213
1187
while (current_scope && current_scope -> type != ZEND_NAMESPACE_CLASS ) {
1214
1188
zend_string * try_name = zend_string_concat3 (
1215
1189
ZSTR_VAL (current_scope -> name ), ZSTR_LEN (current_scope -> name ),
1216
1190
"\\" , 1 ,
1217
- ZSTR_VAL (original_suffix ), ZSTR_LEN (original_suffix ));
1191
+ ZSTR_VAL (name ), ZSTR_LEN (name ));
1218
1192
1219
1193
zend_string * lc_try_name = zend_string_tolower (try_name );
1220
1194
1221
1195
bool has_seen = zend_have_seen_symbol (lc_try_name , ZEND_SYMBOL_CLASS );
1222
1196
zend_string_release (lc_try_name );
1223
1197
1224
1198
if (has_seen ) {
1225
- zend_string_release (original_suffix );
1226
1199
return try_name ;
1227
1200
}
1228
1201
zend_string_release (try_name );
1229
1202
1230
1203
current_scope = current_scope -> lexical_scope ;
1231
1204
}
1232
1205
1233
- zend_string_release (original_suffix );
1234
1206
return NULL ;
1235
1207
}
1236
1208
0 commit comments