Problem/Motivation

The Reflection*::setAccessible() is deprecated and throws deprecation warning since PHP 8.5 beta1.
General usage was removed in #3224941: Remove usage of setAccessible() when core requires PHP 8.1

Steps to reproduce

- https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetacc...
- https://github.com/php/php-src/commit/922c225fbf1a5a7a2e43ebfdff8d91ad91...

Proposed resolution

- remove remaining usage

Remaining tasks

MR, review, commit

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3540525

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andypost created an issue. See original summary.

andypost’s picture

Usage is

core$ git grep setAccessible
core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php:70:    $ref_file_cache->setAccessible(TRUE);
core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php:128:    $ref_file_cache->setAccessible(TRUE);
core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php:51:    $reflection->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Entity/Access/EntityCreateAccessCustomCidTest.php:100:    $access_cache->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Field/FieldTypePluginManagerTest.php:75:    $property->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php:647:    $method->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php:661:    $method->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php:674:    $method->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php:688:    $method->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php:702:    $method->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php:768:    $method->setAccessible(TRUE);
core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php:778:    $method->setAccessible(TRUE);
andypost’s picture

andypost’s picture

Status: Active » Needs review
andypost’s picture

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

pretty straight forward, searched for setAccessible() and found 12 instances all covered by the MR.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 967e3af639f to 11.x and d6d4d9cd564 to 11.2.x. Thanks!

  • alexpott committed d6d4d9cd on 11.2.x
    Issue #3540525 by andypost: Remove remaining usage of setAccessible()
    
    (...

  • alexpott committed 967e3af6 on 11.x
    Issue #3540525 by andypost: Remove remaining usage of setAccessible()
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

andypost’s picture

Filed follow-up as one more left #3551109: Remove last usage of setAccessible()