Commit 5457092f87c for php.net
commit 5457092f87c7e048b9f0946a91f3f553de4a1eb3
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Wed Jul 8 19:52:38 2026 -0700
`ReflectionFunctionAbstract::getDocComment()`: use `zend_function.common`
Internal and userland functions store their documentation comments the same
way, as a `zend_string` pointer. These pointers are part of the common elements
at the start of both `zend_op_array` and `zend_internal_function` that are made
available via `zend_function.common`; use the common access rather than
checking for the different types of functions individually.
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index ea577cdea54..2e585aff34c 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2048,12 +2048,8 @@ ZEND_METHOD(ReflectionFunctionAbstract, getDocComment)
GET_REFLECTION_OBJECT_PTR(fptr);
- if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
- RETURN_STR_COPY(fptr->op_array.doc_comment);
- }
-
- if (fptr->type == ZEND_INTERNAL_FUNCTION && ((zend_internal_function *) fptr)->doc_comment) {
- RETURN_STR_COPY(((zend_internal_function *) fptr)->doc_comment);
+ if (fptr->common.doc_comment) {
+ RETURN_STR_COPY(fptr->common.doc_comment);
}
RETURN_FALSE;