WordPress.org

Make WordPress Core

Changeset 43458


Ignore:
Timestamp:
07/16/2018 02:13:11 PM (19 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.
Merges [43457] to the 4.9 branch.
Fixes #44052.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-login.php

    r43233 r43458  
    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();
     43    }
    4344
    4445    // Shake it!
Note: See TracChangeset for help on using the changeset viewer.