[wp-trac] [WordPress Trac] #63956: PHP 8.5: `setAccessible` deprecations
WordPress Trac
noreply at wordpress.org
Thu Sep 11 12:07:46 UTC 2025
#63956: PHP 8.5: `setAccessible` deprecations
-------------------------------+---------------------------------------
Reporter: swissspidy | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: php85 needs-patch | Focuses: tests, php-compatibility
-------------------------------+---------------------------------------
Description changed by swissspidy:
Old description:
> Parent ticket for all things PHP 8.5: #63061
>
> ----
>
> `ReflectionProperty::setAccessible()` and similar are deprecated since
> 8.5, as they have no effect since 8.1.
>
> The solution is to call these functions only conditionally (e.g. `if
> (\PHP_VERSION_ID < 80100) { $reflection->setAccessible(true); }`)
>
> There are quite a few instances in core tests that we need to fix. See
> https://github.com/search?q=repo%3AWordPress%2Fwordpress-
> develop+setAccessible+language%3APHP&type=code&l=PHP
New description:
Parent ticket for all things PHP 8.5: #63061
----
`ReflectionProperty::setAccessible()` and similar are deprecated since
8.5, as they have no effect since 8.1. See
https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetaccessible
The solution is to call these functions only conditionally (e.g. `if
(\PHP_VERSION_ID < 80100) { $reflection->setAccessible(true); }`)
There are quite a few instances in core tests that we need to fix. See
https://github.com/search?q=repo%3AWordPress%2Fwordpress-
develop+setAccessible+language%3APHP&type=code&l=PHP
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63956#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list