@@ -1080,12 +1080,12 @@ static zend_string *zend_resolve_non_class_name(
1080
1080
return zend_string_init (ZSTR_VAL (name ) + 1 , ZSTR_LEN (name ) - 1 , 0 );
1081
1081
}
1082
1082
1083
- if (type == ZEND_NAME_FQ ) {
1083
+ if (NAME_QUAL ( type ) == ZEND_NAME_FQ ) {
1084
1084
* is_fully_qualified = 1 ;
1085
1085
return zend_string_copy (name );
1086
1086
}
1087
1087
1088
- if (type == ZEND_NAME_RELATIVE ) {
1088
+ if (NAME_QUAL ( type ) == ZEND_NAME_RELATIVE ) {
1089
1089
* is_fully_qualified = 1 ;
1090
1090
return zend_prefix_with_ns (name );
1091
1091
}
@@ -1142,23 +1142,24 @@ static zend_string *zend_resolve_class_name(zend_string *name, uint32_t type) /*
1142
1142
char * compound ;
1143
1143
1144
1144
if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type (name )) {
1145
- if (type == ZEND_NAME_FQ ) {
1145
+ if (NAME_QUAL ( type ) == ZEND_NAME_FQ ) {
1146
1146
zend_error_noreturn (E_COMPILE_ERROR ,
1147
1147
"'\\%s' is an invalid class name" , ZSTR_VAL (name ));
1148
1148
}
1149
- if (type == ZEND_NAME_RELATIVE ) {
1149
+ if (NAME_QUAL ( type ) == ZEND_NAME_RELATIVE ) {
1150
1150
zend_error_noreturn (E_COMPILE_ERROR ,
1151
1151
"'namespace\\%s' is an invalid class name" , ZSTR_VAL (name ));
1152
1152
}
1153
- ZEND_ASSERT (type == ZEND_NAME_NOT_FQ );
1153
+
1154
+ ZEND_ASSERT (NAME_QUAL (type ) == ZEND_NAME_NOT_FQ );
1154
1155
return zend_string_copy (name );
1155
1156
}
1156
1157
1157
- if (type == ZEND_NAME_RELATIVE ) {
1158
+ if (NAME_QUAL ( type ) == ZEND_NAME_RELATIVE ) {
1158
1159
return zend_prefix_with_ns (name );
1159
1160
}
1160
1161
1161
- if (type == ZEND_NAME_FQ ) {
1162
+ if (NAME_QUAL ( type ) == ZEND_NAME_FQ ) {
1162
1163
if (ZSTR_VAL (name )[0 ] == '\\' ) {
1163
1164
/* Remove \ prefix (only relevant if this is a string rather than a label) */
1164
1165
name = zend_string_init (ZSTR_VAL (name ) + 1 , ZSTR_LEN (name ) - 1 , 0 );
@@ -1745,7 +1746,7 @@ uint32_t zend_get_class_fetch_type(const zend_string *name) /* {{{ */
1745
1746
static uint32_t zend_get_class_fetch_type_ast (zend_ast * name_ast ) /* {{{ */
1746
1747
{
1747
1748
/* Fully qualified names are always default refs */
1748
- if (name_ast -> attr == ZEND_NAME_FQ ) {
1749
+ if (NAME_QUAL ( name_ast -> attr ) == ZEND_NAME_FQ ) {
1749
1750
return ZEND_FETCH_CLASS_DEFAULT ;
1750
1751
}
1751
1752
@@ -2874,7 +2875,7 @@ static void zend_compile_class_ref(znode *result, zend_ast *name_ast, uint32_t f
2874
2875
}
2875
2876
2876
2877
/* Fully qualified names are always default refs */
2877
- if (name_ast -> attr == ZEND_NAME_FQ ) {
2878
+ if (NAME_QUAL ( name_ast -> attr ) == ZEND_NAME_FQ ) {
2878
2879
result -> op_type = IS_CONST ;
2879
2880
ZVAL_STR (& result -> u .constant , zend_resolve_class_name_ast (name_ast ));
2880
2881
return ;
@@ -6960,7 +6961,7 @@ static zend_type zend_compile_single_typename(zend_ast *ast)
6960
6961
uint8_t type_code = zend_lookup_builtin_type_by_name (type_name );
6961
6962
6962
6963
if (type_code != 0 ) {
6963
- if ((ast -> attr & ZEND_NAME_NOT_FQ ) != ZEND_NAME_NOT_FQ ) {
6964
+ if (NAME_QUAL (ast -> attr ) != ZEND_NAME_NOT_FQ ) {
6964
6965
zend_error_noreturn (E_COMPILE_ERROR ,
6965
6966
"Type declaration '%s' must be unqualified" ,
6966
6967
ZSTR_VAL (zend_string_tolower (type_name )));
@@ -7004,7 +7005,7 @@ static zend_type zend_compile_single_typename(zend_ast *ast)
7004
7005
zend_string_addref (class_name );
7005
7006
}
7006
7007
7007
- if (ast -> attr == ZEND_NAME_NOT_FQ
7008
+ if (NAME_QUAL ( ast -> attr ) == ZEND_NAME_NOT_FQ
7008
7009
&& zend_is_confusable_type (type_name , & correct_name )
7009
7010
&& zend_is_not_imported (type_name )) {
7010
7011
const char * extra =
@@ -10790,7 +10791,7 @@ static void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
10790
10791
zend_string * orig_name = zend_ast_get_str (name_ast );
10791
10792
zend_string * resolved_name = zend_resolve_const_name (orig_name , name_ast -> attr , & is_fully_qualified );
10792
10793
10793
- if (zend_string_equals_literal (resolved_name , "__COMPILER_HALT_OFFSET__" ) || (name_ast -> attr != ZEND_NAME_RELATIVE && zend_string_equals_literal (orig_name , "__COMPILER_HALT_OFFSET__" ))) {
10794
+ if (zend_string_equals_literal (resolved_name , "__COMPILER_HALT_OFFSET__" ) || (NAME_QUAL ( name_ast -> attr ) != ZEND_NAME_RELATIVE && zend_string_equals_literal (orig_name , "__COMPILER_HALT_OFFSET__" ))) {
10794
10795
zend_ast * last = CG (ast );
10795
10796
10796
10797
while (last && last -> kind == ZEND_AST_STMT_LIST ) {
0 commit comments