[wp-trac] [WordPress Trac] #63956: PHP 8.5: `setAccessible` deprecations

WordPress Trac noreply at wordpress.org
Thu Sep 11 12:07:11 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                    |   Keywords:  php85 needs-patch
  Focuses:  tests, php-compatibility  |
--------------------------------------+-------------------------------
 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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63956>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list