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