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 ); }