Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/CompilerVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', '>=');
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

/**
* Maintainer repro: get_defined_functions(exclude_disabled: true) on reference profile (#16902).
*
* php-src: ext/standard/basic_functions.c — PHP_FUNCTION(get_defined_functions)
*/

$all = get_defined_functions();
$filtered = get_defined_functions(exclude_disabled: true);

if (count($all['internal']) < count($filtered['internal'])) {
echo "fail: filtered internal count exceeds unfiltered\n";
exit(1);
}

if (in_array('utf8_encode', $all['internal'], true)
&& in_array('utf8_encode', $filtered['internal'], true)) {
echo "fail: utf8_encode not filtered\n";
exit(1);
}

echo "ok\n";
4 changes: 2 additions & 2 deletions test/unit/CompilerVersionGateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,9 @@ public function testSupportsGetDeclaredExcludeDeprecatedTrueOnForwardProfile():
}
}

public function testSupportsGetDefinedFunctionsExcludeDisabledFalseOnReferenceProfile(): void
public function testSupportsGetDefinedFunctionsExcludeDisabledTrueOnReferenceProfile(): void
{
$this->assertFalse(CompilerVersion::supportsGetDefinedFunctionsExcludeDisabled());
$this->assertTrue(CompilerVersion::supportsGetDefinedFunctionsExcludeDisabled());
}

public function testSupportsGetDefinedFunctionsExcludeDisabledTrueOnForwardProfile(): void
Expand Down