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
This commit is contained in:
Sergey Biryukov 2016-06-14 15:33:06 +00:00
parent 1a8ca6a167
commit 4eab8aab82
2 changed files with 3 additions and 1 deletions

View File

@ -27,6 +27,8 @@
*/ */
function wp_signon( $credentials = array(), $secure_cookie = '' ) { function wp_signon( $credentials = array(), $secure_cookie = '' ) {
if ( empty($credentials) ) { if ( empty($credentials) ) {
$credentials = array(); // Back-compat for plugins passing an empty string.
if ( ! empty($_POST['log']) ) if ( ! empty($_POST['log']) )
$credentials['user_login'] = $_POST['log']; $credentials['user_login'] = $_POST['log'];
if ( ! empty($_POST['pwd']) ) if ( ! empty($_POST['pwd']) )

View File

@ -790,7 +790,7 @@ default:
$reauth = empty($_REQUEST['reauth']) ? false : true; $reauth = empty($_REQUEST['reauth']) ? false : true;
$user = wp_signon( '', $secure_cookie ); $user = wp_signon( array(), $secure_cookie );
if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
if ( headers_sent() ) { if ( headers_sent() ) {