Skip to content

Stdlib: ReflectionClass::getMethods() IS_STATIC filter parity (#4480) - #16701

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-4480-reflection-getmethods-filter
Jul 6, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-4480-reflection-getmethods-filter

Conversation

@PurHur

@PurHur PurHur commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix ReflectionClass::getMethods() filter handling: IS_STATIC (and final/abstract flags) now derive from method visibility via cfgMethodFlagsToReflectionModifiers instead of visibility-only matching.
  • Add maintainer repro and compliance .phpt guard.

Root cause

collectClassMethodsForReflection() used matchesReflectionVisibilityFilter(), which never set the static bit when evaluating filter masks — IS_STATIC-only queries returned an empty list.

php-src reference

ext/reflection/php_reflection.c — zim_ReflectionClass_getMethods

Verification

php test/repro-maintainer/reflection_class_get_methods.php
php bin/vm.php test/repro-maintainer/reflection_class_get_methods.php
# IS_STATIC section now prints: A::statA (matches Zend)

vendor/bin/phpunit test/compliance/VMTest.php --filter reflection_class_get_methods_filter
# OK (1 test, 1 assertion)

./script/ci-fast.sh --filter reflection_class_get_methods_filter
# exit 0

Closes #4480

Made with Cursor

methodMatchesReflectionFilter now maps static/final/abstract method flags
via cfgMethodFlagsToReflectionModifiers so IS_STATIC filter matches Zend.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit a2d99b1 into master Jul 6, 2026
@PurHur
PurHur deleted the agent/issue-4480-reflection-getmethods-filter branch July 6, 2026 00:46
PurHur added a commit that referenced this pull request Jul 6, 2026
#16706)

Regenerate docs/bootstrap-inventory.md after VmReflection method count drift (#16701).
Enable display_errors in file_stat_null_coerce.phpt so rename(null) E_WARNING is
captured on stdout per php-src PHPT semantics (deprecations masked).

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: ReflectionClass::getMethods() — filter flags + inheritance/visibility parity (ext/reflection/php_reflection.c)

1 participant