This commit is contained in:
Javier Casares 2026-09-17 10:57:29 +00:00
commit c72a96e2a0
4 changed files with 69 additions and 46 deletions

View file

@ -85,13 +85,13 @@ class Geo_Restrictions {
*
* @since 1.5.0
*
* @param mixed $user Previously authenticated user or null.
* @param string $username Submitted username.
* @param string $password Submitted password.
* @param mixed $user Previously authenticated user or null.
* @param string|null $username Submitted username.
* @param string|null $password Submitted password.
*
* @return mixed
*/
public function maybe_block_denied_country( mixed $user, string $username, string $password ): mixed {
public function maybe_block_denied_country( mixed $user, ?string $username, ?string $password ): mixed {
unset( $username, $password );
$deny_list = $this->config->get_geoip_country_deny();

View file

@ -82,13 +82,13 @@ class IP_Restrictions {
*
* @since 1.3.0
*
* @param mixed $user Previously authenticated user or error.
* @param string $username Submitted username.
* @param string $password Submitted password.
* @param mixed $user Previously authenticated user or error.
* @param string|null $username Submitted username.
* @param string|null $password Submitted password.
*
* @return mixed
*/
public function maybe_block_denied_ip( mixed $user, string $username, string $password ): mixed {
public function maybe_block_denied_ip( mixed $user, ?string $username, ?string $password ): mixed {
unset( $username, $password );
$deny_list = $this->config->get_ip_deny();

View file

@ -463,16 +463,21 @@ class Login_Form_Manager {
<?php
}
/**
* Display a contextual login message during the verification stage.
*
* @since 1.0.0
*
* @param string $message Existing login form message HTML.
*
* @return string
*/
public function filter_login_message( string $message ): string {
/**
* Display a contextual login message during the verification stage.
*
* @since 1.0.0
* @since 1.6.5 Accepts a null $message: newer WordPress versions pass
* null through the `login_message` filter when no message
* is set, which fatalled the string-typed parameter.
*
* @param string|null $message Existing login form message HTML.
*
* @return string
*/
public function filter_login_message( ?string $message ): string {
$message = $message ?? '';
if ( ! $this->is_verification_stage() ) {
return $message;
}
@ -619,12 +624,12 @@ class Login_Form_Manager {
* Attempt to finish the verification stage during authentication.
*
* @param \WP_User|\WP_Error|null $user Previously authenticated user or error.
* @param string $username Submitted username.
* @param string $password Submitted password.
* @param string|null $username Submitted username.
* @param string|null $password Submitted password.
*
* @return \WP_User|\WP_Error|null
*/
public function maybe_complete_verification( $user, string $username, string $password ) {
public function maybe_complete_verification( $user, ?string $username, ?string $password ) {
if ( ! $this->is_verification_submission() ) {
return $user;
}
@ -785,12 +790,12 @@ class Login_Form_Manager {
* Enforce the verification step for eligible users.
*
* @param \WP_User|\WP_Error|null $user Previously authenticated user or error.
* @param string $username Submitted username.
* @param string $password Submitted password.
* @param string|null $username Submitted username.
* @param string|null $password Submitted password.
*
* @return \WP_User|\WP_Error|null
*/
public function enforce_verification_challenge( $user, string $username, string $password ) {
public function enforce_verification_challenge( $user, ?string $username, ?string $password ) {
unset( $username, $password );
if ( $this->is_verification_stage() || $this->is_verification_submission() ) {

View file

@ -1113,14 +1113,16 @@ class Profile_Settings {
/**
* Append the 2FA section anchor to redirects when requested.
*
* @param string $location Redirect destination.
* @param int $status HTTP status code.
* @param string|null $location Redirect destination (null from sloppy wp_redirect() callers).
* @param int|null $status HTTP status code.
*
* @return string
*/
public function maybe_append_section_anchor( string $location, int $status ): string {
public function maybe_append_section_anchor( ?string $location, ?int $status = null ): string {
unset( $status );
$location = $location ?? '';
if ( ! $this->focus_section ) {
return $location;
}