From 822a6d1016ae64a5a58f552ee1c298516e009140 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 23 Jul 2026 22:49:29 +0200 Subject: [PATCH 1/4] remove setAccessible --- tests/class-two-factor-core.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/class-two-factor-core.php b/tests/class-two-factor-core.php index 594d119d..4b4746db 100644 --- a/tests/class-two-factor-core.php +++ b/tests/class-two-factor-core.php @@ -165,7 +165,6 @@ private function do_redirect_callable( $callback ) { private function reset_profile_errors() { $reflection = new ReflectionClass( Two_Factor_Core::class ); $prop = $reflection->getProperty( 'profile_errors' ); - $prop->setAccessible( true ); $prop->setValue( null, array() ); } @@ -2371,7 +2370,6 @@ public function test_collect_auth_cookie_tokens() { // but capture the original value so it can be restored afterward. $reflection = new ReflectionClass( Two_Factor_Core::class ); $prop = $reflection->getProperty( 'password_auth_tokens' ); - $prop->setAccessible( true ); $original_tokens = $prop->getValue( null ); try { From 60cd6214dfa28386ba9ce951e08e68cde3e3d1d3 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 23 Jul 2026 22:49:40 +0200 Subject: [PATCH 2/4] remove setAccessible --- tests/providers/class-two-factor-totp.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/providers/class-two-factor-totp.php b/tests/providers/class-two-factor-totp.php index 50ea34f8..c4cbd0ce 100644 --- a/tests/providers/class-two-factor-totp.php +++ b/tests/providers/class-two-factor-totp.php @@ -454,7 +454,6 @@ public function test_sha512_authenticate() { */ private function call_pad_secret( $secret, $length ) { $method = new ReflectionMethod( 'Two_Factor_Totp', 'pad_secret' ); - $method->setAccessible( true ); return $method->invoke( null, $secret, $length ); } From d16d82c5ffc7de5773aaec950dda8384fcca36a1 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 23 Jul 2026 23:03:35 +0200 Subject: [PATCH 3/4] fix setaccessible notice --- tests/class-two-factor-core.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/class-two-factor-core.php b/tests/class-two-factor-core.php index 4b4746db..f3157b44 100644 --- a/tests/class-two-factor-core.php +++ b/tests/class-two-factor-core.php @@ -165,6 +165,9 @@ private function do_redirect_callable( $callback ) { private function reset_profile_errors() { $reflection = new ReflectionClass( Two_Factor_Core::class ); $prop = $reflection->getProperty( 'profile_errors' ); + if ( PHP_VERSION_ID < 80100 ) { + $prop->setAccessible( true ); + } $prop->setValue( null, array() ); } @@ -2370,6 +2373,9 @@ public function test_collect_auth_cookie_tokens() { // but capture the original value so it can be restored afterward. $reflection = new ReflectionClass( Two_Factor_Core::class ); $prop = $reflection->getProperty( 'password_auth_tokens' ); + if ( PHP_VERSION_ID < 80100 ) { + $prop->setAccessible( true ); + } $original_tokens = $prop->getValue( null ); try { From 52bfa03145ee7ca328e4172d31fb94178efd61f7 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 23 Jul 2026 23:04:04 +0200 Subject: [PATCH 4/4] fix setAccessible --- tests/providers/class-two-factor-totp.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/providers/class-two-factor-totp.php b/tests/providers/class-two-factor-totp.php index c4cbd0ce..2b2f15d6 100644 --- a/tests/providers/class-two-factor-totp.php +++ b/tests/providers/class-two-factor-totp.php @@ -454,6 +454,9 @@ public function test_sha512_authenticate() { */ private function call_pad_secret( $secret, $length ) { $method = new ReflectionMethod( 'Two_Factor_Totp', 'pad_secret' ); + if ( PHP_VERSION_ID < 80100 ) { + $method->setAccessible( true ); + } return $method->invoke( null, $secret, $length ); }