WordPress.org

Make WordPress Core

Changeset 43457


Ignore:
Timestamp:
07/16/2018 02:09:22 PM (20 months ago)
Author:
SergeyBiryukov
Message:

Login and Registration: Set a better default value for $wp_error parameter in login_header().

To prevent someone from passing a string (which would not be added to a new WP_Error instance), check for is_wp_error() explicitly.

Props desrosj, chetan200891, spyderbytes, lbenicio, sebastien@…, abdullahramzan.
Fixes #44052.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-login.php

    r43232 r43457  
    2929 *                           Default 'Log In'.
    3030 * @param string   $message  Optional. Message to display in header. Default empty.
    31  * @param WP_Error $wp_error Optional. The error to pass. Default empty.
     31 * @param WP_Error $wp_error Optional. The error to pass. Default is a WP_Error instance.
    3232 */
    33 function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
     33function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
    3434    global $error, $interim_login, $action;
    3535
     
    3939    add_action( 'login_head', 'wp_login_viewport_meta' );
    4040
    41     if ( empty( $wp_error ) ) {
     41    if ( ! is_wp_error( $wp_error ) ) {
    4242        $wp_error = new WP_Error();
    4343    }
Note: See TracChangeset for help on using the changeset viewer.