@@ -231,14 +231,7 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
231
231
case REF_TYPE_TYPE :
232
232
{
233
233
type_reference * type_ref = intern -> ptr ;
234
- if (ZEND_TYPE_HAS_LIST (type_ref -> type )) {
235
- void * entry ;
236
- ZEND_TYPE_LIST_FOREACH (ZEND_TYPE_LIST (type_ref -> type ), entry ) {
237
- if (ZEND_TYPE_LIST_IS_NAME (entry )) {
238
- zend_string_release (ZEND_TYPE_LIST_GET_NAME (entry ));
239
- }
240
- } ZEND_TYPE_LIST_FOREACH_END ();
241
- } else if (ZEND_TYPE_HAS_NAME (type_ref -> type )) {
234
+ if (ZEND_TYPE_HAS_NAME (type_ref -> type )) {
242
235
zend_string_release (ZEND_TYPE_NAME (type_ref -> type ));
243
236
}
244
237
efree (type_ref );
@@ -1174,16 +1167,12 @@ static void reflection_type_factory(zend_type type, zval *object, zend_bool lega
1174
1167
intern -> ptr = reference ;
1175
1168
intern -> ref_type = REF_TYPE_TYPE ;
1176
1169
1177
- /* Property types may be resolved during the lifetime of the ReflectionType,
1178
- * so we need to make sure that the strings we reference are not released. */
1179
- if (ZEND_TYPE_HAS_LIST (type )) {
1180
- void * entry ;
1181
- ZEND_TYPE_LIST_FOREACH (ZEND_TYPE_LIST (type ), entry ) {
1182
- if (ZEND_TYPE_LIST_IS_NAME (entry )) {
1183
- zend_string_addref (ZEND_TYPE_LIST_GET_NAME (entry ));
1184
- }
1185
- } ZEND_TYPE_LIST_FOREACH_END ();
1186
- } else if (ZEND_TYPE_HAS_NAME (type )) {
1170
+ /* Property types may be resolved during the lifetime of the ReflectionType.
1171
+ * If we reference a string, make sure it doesn't get released. However, only
1172
+ * do this for the top-level type, as resolutions inside type lists will be
1173
+ * fully visible to us (we'd have to do a fully copy of the type if we wanted
1174
+ * to prevent that). */
1175
+ if (ZEND_TYPE_HAS_NAME (type )) {
1187
1176
zend_string_addref (ZEND_TYPE_NAME (type ));
1188
1177
}
1189
1178
}
0 commit comments