mirror of
git://develop.git.wordpress.org/
synced 2025-03-15 01:19:51 +01:00
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@thivinfo.com, abdullahramzan. Merges [43457] to the 4.9 branch. Fixes #44052. git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43458 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
358e9e08f1
commit
b7f86906c7
@ -28,9 +28,9 @@ if ( force_ssl_admin() && ! is_ssl() ) {
|
||||
* @param string $title Optional. WordPress login Page title to display in the `<title>` element.
|
||||
* Default 'Log In'.
|
||||
* @param string $message Optional. Message to display in header. Default empty.
|
||||
* @param WP_Error $wp_error Optional. The error to pass. Default empty.
|
||||
* @param WP_Error $wp_error Optional. The error to pass. Default is a WP_Error instance.
|
||||
*/
|
||||
function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
|
||||
function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
|
||||
global $error, $interim_login, $action;
|
||||
|
||||
// Don't index any of these forms
|
||||
@ -38,8 +38,9 @@ function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
|
||||
|
||||
add_action( 'login_head', 'wp_login_viewport_meta' );
|
||||
|
||||
if ( empty($wp_error) )
|
||||
if ( ! is_wp_error( $wp_error ) ) {
|
||||
$wp_error = new WP_Error();
|
||||
}
|
||||
|
||||
// Shake it!
|
||||
$shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
|
||||
|
Loading…
x
Reference in New Issue
Block a user