Skip to content

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 9, 2025

Description

Since PHP 8.1, calling the Reflection*::setAccessible() methods is no longer necessary as reflected properties/methods/etc will always be accessible. However, the method calls are still needed for PHP < 8.1.

As of PHP 8.5, calling the Reflection*::setAccessible() methods is now formally deprecated and will yield a deprecation notice, which will fail test runs. As of PHP 9.0, the setAccessible() method(s) will be removed.

With the latter in mind, this commit prevents the deprecation notice by making the calls to setAccessible() conditional.

Silencing the deprecation would mean, this would need to be "fixed" again come PHP 9.0, while the current solution should be stable, including for PHP 9.0.

Ref: https://wiki.php.net/rfc/deprecations_php_8_5#extreflection_deprecations

Suggested changelog entry

N/A: test only change

…sible()

Since PHP 8.1, calling the `Reflection*::setAccessible()` methods is no longer necessary as reflected properties/methods/etc will always be accessible.
However, the method calls are still needed for PHP < 8.1.

As of PHP 8.5, calling the `Reflection*::setAccessible()` methods is now formally deprecated and will yield a deprecation notice, which will fail test runs.
As of PHP 9.0, the `setAccessible()` method(s) will be removed.

With the latter in mind, this commit prevents the deprecation notice by making the calls to `setAccessible()` conditional.

Silencing the deprecation would mean, this would need to be "fixed" again come PHP 9.0, while the current solution should be stable, including for PHP 9.0.

Ref: https://wiki.php.net/rfc/deprecations_php_8_5#extreflection_deprecations
@jrfnl jrfnl added this to the 3.13.3 milestone Aug 9, 2025
@jrfnl
Copy link
Member Author

jrfnl commented Aug 9, 2025

Notes:

  1. This PR is not claiming to fix all PHP 8.5 runtime deprecations - not all PRs have been merged into PHP Core yet, so there may be more issues which need fixing.
  2. There will currently be one remaining test failure. This is not something we need to fix, but was a snafu in PHP Core itself, which has been fixed in the mean time, but the setup-php PHP 8.5 image only updates once every 24 hours, so the failure should be gone once the image has been re-generated.

@jrfnl jrfnl merged commit 9033cfc into master Aug 9, 2025
88 of 90 checks passed
@jrfnl jrfnl deleted the feature/fix-test-runtime-deprecations-php-8.5 branch August 9, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant