From c75fe8bd5025b506ba5f182abe4f10fb97c950aa Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 25 Aug 2025 11:27:13 +0200 Subject: [PATCH] Tests: avoid `setAccessible` deprecation warnings --- src/User_Session_Command.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/User_Session_Command.php b/src/User_Session_Command.php index 3949d6f9..d20f94c4 100644 --- a/src/User_Session_Command.php +++ b/src/User_Session_Command.php @@ -173,7 +173,9 @@ public function list_( $args, $assoc_args ) { protected function get_all_sessions( WP_Session_Tokens $manager ) { // Make the private session data accessible to WP-CLI $get_sessions = new ReflectionMethod( $manager, 'get_sessions' ); - $get_sessions->setAccessible( true ); + if ( PHP_VERSION_ID < 80100 ) { + $get_sessions->setAccessible( true ); + } /** * @var array $sessions @@ -194,7 +196,9 @@ function ( &$session, $token ) { protected function destroy_session( WP_Session_Tokens $manager, $token ) { $update_session = new ReflectionMethod( $manager, 'update_session' ); - $update_session->setAccessible( true ); + if ( PHP_VERSION_ID < 80100 ) { + $update_session->setAccessible( true ); + } return $update_session->invoke( $manager, $token, null ); }