Removes three calls to ReflectionProperty::setAccessible() / ReflectionMethod::setAccessible() in the test suite#942
Draft
masteradhoc wants to merge 4 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Removes three calls to
ReflectionProperty::setAccessible()/ReflectionMethod::setAccessible()for PHP 8.1+ in the test suite.Fixes #
Why?
See: https://www.php.net/manual/de/reflectionmethod.setaccessible.php
Since PHP 8.1, reflection properties and methods are accessible without calling
setAccessible( true ), making the call a no-op. As of PHP 8.5, calling it is deprecated and emits aPHP Deprecatednotice, which was showing up as noise in test runs (tests/class-two-factor-core.php:168,:2374,tests/providers/class-two-factor-totp.php:457)................................................................ 63 / 232 ( 27%) [23-Jul-2026 20:30:55 UTC] PHP Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/wp-content/plugins/two-factor/tests/class-two-factor-core.php on line 168 .......Received a non-notice error: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/wp-content/plugins/two-factor/tests/class-two-factor-core.php on line 168 [23-Jul-2026 20:30:55 UTC] PHP Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/wp-content/plugins/two-factor/tests/class-two-factor-core.php on line 2398 Received a non-notice error: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1Received a non-notice error: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1.Received a non-notice error: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1Received a non-notice error: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1Received a non-notice error: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1...Received a non-notice error: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/wp-content/plugins/two-factor/tests/class-two-factor-core.php on line 2398 ...................................F................ 126 / 232 ( 54%) ............................................................... 189 / 232 ( 81%) [23-Jul-2026 20:30:57 UTC] PHP Deprecated: Method ReflectionMethod::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/wp-content/plugins/two-factor/tests/providers/class-two-factor-totp.php on line 457 ...................................... Deprecated: Method ReflectionMethod::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/wp-content/plugins/two-factor/tests/providers/class-two-factor-totp.php on line 457How?
Deleted the three now-redundant
setAccessible( true )lines. No behavior change — the reflection objects were already accessible without it.Use of AI Tools
Testing Instructions
ReflectionProperty::setAccessible() is deprecated/ReflectionMethod::setAccessible() is deprecatednotices no longer appear.Changelog Entry