From 4eab8aab82d1d6e75a875d3ae7e8198efbbcee6b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 14 Jun 2016 15:33:06 +0000 Subject: [PATCH] Users: `wp_signon()` expects an array as the `$credentials` argument, not a string. If an empty string was passed, redeclare it as an empty array to avoid a warning and a fatal error in PHP 7.1.0 Alpha 1. Props simonvik. Fixes #37071. git-svn-id: https://develop.svn.wordpress.org/trunk@37697 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/user.php | 2 ++ src/wp-login.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index aa225a6718..0bfc9e5fc4 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -27,6 +27,8 @@ */ function wp_signon( $credentials = array(), $secure_cookie = '' ) { if ( empty($credentials) ) { + $credentials = array(); // Back-compat for plugins passing an empty string. + if ( ! empty($_POST['log']) ) $credentials['user_login'] = $_POST['log']; if ( ! empty($_POST['pwd']) ) diff --git a/src/wp-login.php b/src/wp-login.php index 9a8a059c5e..46f1507d85 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -790,7 +790,7 @@ default: $reauth = empty($_REQUEST['reauth']) ? false : true; - $user = wp_signon( '', $secure_cookie ); + $user = wp_signon( array(), $secure_cookie ); if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { if ( headers_sent() ) {