From 80a325fda9c218b0924c0eed2bc6af0ac1eba45b Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 27 Nov 2017 01:14:32 +0000 Subject: [PATCH] WPDB: Check that `AUTH_SALT` is not empty, Fix a PHP notice when `AUTH_SALT` is undefined. Props jsonfry, mkomar, pento. Merges [42119] and [42120] to the 3.9 branch. Fixes #42431 and #42401 for 3.9. Built from https://develop.svn.wordpress.org/branches/3.9@42239 git-svn-id: http://core.svn.wordpress.org/branches/3.9@42068 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 1e54f6e75d..82b889f1e2 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1767,7 +1767,7 @@ class wpdb { // If ext/hash is not present, compat.php's hash_hmac() does not support sha256. $algo = function_exists( 'hash' ) ? 'sha256' : 'sha1'; // Old WP installs may not have AUTH_SALT defined. - $salt = defined( 'AUTH_SALT' ) ? AUTH_SALT : rand(); + $salt = defined( 'AUTH_SALT' ) && AUTH_SALT ? AUTH_SALT : (string) rand(); $placeholder = '{' . hash_hmac( $algo, uniqid( $salt, true ), $salt ) . '}'; }