Skip to content

Stdlib: ReflectionFunction::isDeprecated() false on 8.2 profile (#16359) - #16770

Merged
PurHur merged 1 commit into
masterfrom
fix/16359-reflection-function-isdeprecated-profile
Jul 6, 2026
Merged

PurHur merged 1 commit into
masterfrom
fix/16359-reflection-function-isdeprecated-profile

Conversation

@PurHur

@PurHur PurHur commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #16359 — ReflectionFunction::isDeprecated() on the 8.2 reference profile.

php-src (ext/reflection/php_reflection.c) exposes isDeprecated() on PHP 8.2 but the PHP_VERSION_ID >= 80400 guard always returns false until 8.4. We previously hid the method entirely on the reference profile, which diverged from Zend; on 8.4 profile we correctly returned true for #[\Deprecated] functions.

  • Always register ReflectionFunction::isDeprecated in lib/VM/BuiltinClasses.php
  • Return false on reference profile in ReflectionFunctionIsDeprecated (before reading deprecated metadata)
  • Update compliance guard + add maintainer repro

php-src reference

  • ext/reflection/php_reflection.c — reflection_function_is_deprecated() version gate

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/maintainer_gap_reflection_function_isdeprecated_profile.php
php bin/vm.php test/repro/maintainer_gap_reflection_function_isdeprecated_profile.php
php bin/vm.php test/compliance/cases/language/reflection_function_is_deprecated_profile.phpt
PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/compliance/cases/language/reflection_function_is_deprecated_forward_profile.phpt
php bin/compile.php -l test/repro/maintainer_gap_reflection_function_isdeprecated_profile.php
vendor/bin/phpunit --filter reflection_function_is_deprecated
'

Output:

ok
ok
yes
false
false
true
false
OK (1 test, 1 assertion)

Closes #16359

Made with Cursor

php-src exposes the method on 8.2 but gates deprecated metadata behind PHP_VERSION_ID >= 80400.
Always register the VM method and return false on reference profile; 8.4+ reports #[\Deprecated].

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit cff2249 into master Jul 6, 2026
@PurHur
PurHur deleted the fix/16359-reflection-function-isdeprecated-profile branch July 6, 2026 04:42
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.

Regression: ReflectionFunction::isDeprecated() true on 8.2 profile — Zend false (re-#9760, ext/reflection/php_reflection.c)

1 participant