From 76e00fa9512f01458c63fe5c2c640328add5b584 Mon Sep 17 00:00:00 2001 From: PurHur Date: Mon, 6 Jul 2026 13:09:57 +0000 Subject: [PATCH] Stdlib: enable get_defined_functions(exclude_disabled:) on reference profile (#16902) PHP 8.2+ exposes optional exclude_disabled unlike get_declared_* exclude_deprecated (8.4-only). Gate BuiltinParamNames on REFERENCE_PHP_VERSION so named args work without PHP_COMPILER_PROFILE=8.4. Co-authored-by: Cursor --- lib/CompilerVersion.php | 7 ++++-- ...d_functions_exclude_disabled_reference.php | 25 +++++++++++++++++++ test/unit/CompilerVersionGateTest.php | 4 +-- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 test/repro/maintainer_gap_get_defined_functions_exclude_disabled_reference.php diff --git a/lib/CompilerVersion.php b/lib/CompilerVersion.php index 04461e966f..15897f4c02 100644 --- a/lib/CompilerVersion.php +++ b/lib/CompilerVersion.php @@ -619,11 +619,14 @@ public static function supportsGetDeclaredExcludeDeprecated(): bool } /** - * PHP 8.4+ get_defined_functions() optional $exclude_disabled (ext/standard/basic_functions.c, #4942). + * PHP 8.2+ get_defined_functions() optional $exclude_disabled (ext/standard/basic_functions.c, #4942). + * + * Unlike {@see supportsGetDeclaredExcludeDeprecated()} (PHP 8.4-only), Zend exposes this on the + * reference profile — BuiltinParamNames must register exclude_disabled without forward gating. */ public static function supportsGetDefinedFunctionsExcludeDisabled(): bool { - return self::supportsGetDeclaredExcludeDeprecated(); + return version_compare(self::REFERENCE_PHP_VERSION, '8.2.0', '>='); } /** diff --git a/test/repro/maintainer_gap_get_defined_functions_exclude_disabled_reference.php b/test/repro/maintainer_gap_get_defined_functions_exclude_disabled_reference.php new file mode 100644 index 0000000000..679e76fc13 --- /dev/null +++ b/test/repro/maintainer_gap_get_defined_functions_exclude_disabled_reference.php @@ -0,0 +1,25 @@ +assertFalse(CompilerVersion::supportsGetDefinedFunctionsExcludeDisabled()); + $this->assertTrue(CompilerVersion::supportsGetDefinedFunctionsExcludeDisabled()); } public function testSupportsGetDefinedFunctionsExcludeDisabledTrueOnForwardProfile(): void