#63956 closed defect (bug) (fixed)
PHP 8.5: `setAccessible` deprecations
| Reported by: | swissspidy | Owned by: | swissspidy |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.9 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | php85 has-patch has-unit-tests |
| Cc: | Focuses: | tests, php-compatibility |
Description (last modified by )
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
Change History (7)
This ticket was mentioned in PR #9847 on WordPress/wordpress-develop by @rishabhwp.
13 months ago
#4
- Keywords has-patch has-unit-tests added; needs-patch removed
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I’d be happy to work on this and will submit a PR soon.