Skip to content

Commit 59802bb

Browse files
committed
Fixup reflection after rebase
1 parent 6abe540 commit 59802bb

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

ext/reflection/php_reflection.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,14 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
231231
case REF_TYPE_TYPE:
232232
{
233233
type_reference *type_ref = intern->ptr;
234-
if (ZEND_TYPE_IS_NAME(type_ref->type)) {
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)) {
235242
zend_string_release(ZEND_TYPE_NAME(type_ref->type));
236243
}
237244
efree(type_ref);
@@ -1169,7 +1176,14 @@ static void reflection_type_factory(zend_type type, zval *object, zend_bool lega
11691176

11701177
/* Property types may be resolved during the lifetime of the ReflectionType,
11711178
* so we need to make sure that the strings we reference are not released. */
1172-
if (ZEND_TYPE_IS_NAME(type)) {
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)) {
11731187
zend_string_addref(ZEND_TYPE_NAME(type));
11741188
}
11751189
}
@@ -6535,7 +6549,7 @@ static const zend_function_entry reflection_named_type_functions[] = {
65356549
};
65366550

65376551
static const zend_function_entry reflection_union_type_functions[] = {
6538-
ZEND_ME(reflection_union_type, getTypes, arginfo_reflection__void, 0)
6552+
ZEND_ME(reflection_union_type, getTypes, arginfo_class_ReflectionUnionType_getTypes, 0)
65396553
PHP_FE_END
65406554
};
65416555

ext/reflection/reflection.stub.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,11 @@ public function getName() {}
552552
public function isBuiltin() {}
553553
}
554554

555+
class ReflectionUnionType extends ReflectionType
556+
{
557+
public function getTypes(): array {}
558+
}
559+
555560
class ReflectionExtension implements Reflector
556561
{
557562
final private function __clone() {}

ext/reflection/reflection_arginfo.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ ZEND_END_ARG_INFO()
428428

429429
#define arginfo_class_ReflectionNamedType_isBuiltin arginfo_class_Reflector___toString
430430

431+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionUnionType_getTypes, 0, 0, IS_ARRAY, 0)
432+
ZEND_END_ARG_INFO()
433+
431434
#define arginfo_class_ReflectionExtension___clone arginfo_class_Reflector___toString
432435

433436
#define arginfo_class_ReflectionExtension_export arginfo_class_ReflectionFunction_export

0 commit comments

Comments
 (0)