From d0db26891035a3f8d5663d485192eee7f41b301b Mon Sep 17 00:00:00 2001 From: Isaac Russell <24508439+sisaacrussell@users.noreply.github.com> Date: Sat, 16 Mar 2024 14:29:41 -0500 Subject: [PATCH] Update class-login.php Use the null coalescing operator to ensure $user_agent is always a string. This prevents passing null to strpos, which is deprecated in newer PHP versions. --- src/wp-includes/class-login.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-login.php b/src/wp-includes/class-login.php index a2fca32..964119d 100755 --- a/src/wp-includes/class-login.php +++ b/src/wp-includes/class-login.php @@ -88,7 +88,9 @@ public function process( $user_id ) { } // Check for bots. - $user_agent = filter_input( INPUT_SERVER, 'HTTP_USER_AGENT' ); + // Use the null coalescing operator to ensure $user_agent is always a string. + // This prevents passing null to strpos, which is deprecated in newer PHP versions. + $user_agent = filter_input( INPUT_SERVER, 'HTTP_USER_AGENT' ) ?? ''; $bot = false !== strpos( $user_agent, 'bot' ); if ( $bot ) { return $user_id;