Blocks PHPUnit-style runners, DI containers, and self-host reflection tooling.
<?php
declare(strict_types=1);
class A {
public function pubA(): void {}
protected function protA(): void {}
private function privA(): void {}
public static function statA(): void {}
}
class B extends A {
public function pubB(): void {}
private function privB(): void {}
}
$r = new ReflectionClass(B::class);
foreach ($r->getMethods() as $m) {
echo $m->getDeclaringClass()->getName(), '::', $m->getName(), "\n";
}
echo "--- public only ---\n";
foreach ($r->getMethods(ReflectionMethod::IS_PUBLIC) as $m) {
echo $m->getDeclaringClass()->getName(), '::', $m->getName(), "\n";
}
echo "--- static only ---\n";
foreach ($r->getMethods(ReflectionMethod::IS_STATIC) as $m) {
echo $m->getDeclaringClass()->getName(), '::', $m->getName(), "\n";
}
Category
stdlib· php-src-strict · spec refresh 2026-06-20Problem
ReflectionClass::getMethods(?int $filter = null): arrayreturns incorrect method sets vs Zend/php-src:ReflectionClass)ReflectionMethod::IS_PUBLIC/IS_PROTECTED/IS_PRIVATE)IS_STATIC,IS_ABSTRACT,IS_FINALfilter flagsReflectionMethod::getDeclaringClass())Blocks PHPUnit-style runners, DI containers, and self-host reflection tooling.
Focused sub-issue: parent-private leak tracked as #7191 (implement first or together).
php-src reference
ext/reflection/php_reflection.c—zim_ReflectionClass_getMethods, filter bitmaskext/reflection/tests/ReflectionClass_getMethods_001.phptRepro (failure today — verified 2026-06-20)
test/repro-maintainer/reflection_class_get_methods.php:Expected (Zend PHP 8.2+)
A::protA,A::pubA,A::statA,B::pubB— excludeA::privA,B::privBIS_PUBLICA::pubA,A::statA,B::pubBIS_STATICA::statAActual (
bin/vm.php, 2026-06-20)A::privAandB::privB(private leak)Scope (this repo)
ext/standard/VmReflection.php— walkClassEntrymethod tables + inheritancelib/VM/BuiltinClasses.php—ReflectionMethodmaterializationReflectionClass_getMethods_001.phptsubset + #7191 private-leak PHPTPHP-in-PHP: reflection tables in
lib/+ext/standard; no newruntime/*.c.Done when (php-src-strict)
diffempty between Zend andbin/vm.phpfor all three sectionsIS_PUBLIC/IS_PROTECTED/IS_PRIVATE/IS_STATICmatch Zend./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter reflection_class_get_methods'green./script/ci-fast.sh --filter reflection_class_get_methodsgreenRelated