@@ -6310,20 +6310,20 @@ static zend_type zend_compile_typename(
6310
6310
for (uint32_t i = 0 ; i < list -> children ; i ++ ) {
6311
6311
zend_ast * type_ast = list -> child [i ];
6312
6312
zend_type single_type = zend_compile_single_typename (type_ast );
6313
- zend_string * standard_type_str = zend_type_to_string (single_type );
6314
6313
6315
6314
/* An intersection of standard types cannot exist so invalidate it */
6316
6315
if (ZEND_TYPE_IS_ONLY_MASK (single_type )) {
6316
+ zend_string * standard_type_str = zend_type_to_string (single_type );
6317
6317
zend_error_noreturn (E_COMPILE_ERROR ,
6318
6318
"Type %s cannot be part of an intersection type" , ZSTR_VAL (standard_type_str ));
6319
+ zend_string_release_ex (standard_type_str , false);
6319
6320
}
6320
6321
/* Check for "self" and "parent" too */
6321
- if (zend_string_equals_literal_ci (standard_type_str , "self" )
6322
- || zend_string_equals_literal_ci (standard_type_str , "parent" )) {
6322
+ if (zend_string_equals_literal_ci (ZEND_TYPE_NAME ( single_type ) , "self" )
6323
+ || zend_string_equals_literal_ci (ZEND_TYPE_NAME ( single_type ) , "parent" )) {
6323
6324
zend_error_noreturn (E_COMPILE_ERROR ,
6324
- "Type %s cannot be part of an intersection type" , ZSTR_VAL (standard_type_str ));
6325
+ "Type %s cannot be part of an intersection type" , ZSTR_VAL (ZEND_TYPE_NAME ( single_type ) ));
6325
6326
}
6326
- zend_string_release_ex (standard_type_str , false);
6327
6327
6328
6328
/* Add type to the type list */
6329
6329
type_list -> types [type_list -> num_types ++ ] = single_type ;
0 commit comments