From 002d65112f87924a87839d4d103908b8f5759b3b Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 7 Nov 2017 00:30:46 +0000 Subject: [PATCH] WPDB: Fix a PHP notice when `AUTH_SALT` is undefined. In `wpdb::placeholder_escape()`, the key for `hash_hmac()` falls back to `rand()` when `AUTH_SALT` is undefined. `hash_hmac()` requires the key to be a string, however, so we need to cast it as such. Props mkomar. Fixes #42401. Built from https://develop.svn.wordpress.org/trunk@42119 git-svn-id: http://core.svn.wordpress.org/trunk@41948 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/wp-db.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index ddf9c6eb6b..2314a391c3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-RC1-42118'; +$wp_version = '4.9-RC1-42119'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index e7ec314e7b..04792d4db4 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1946,7 +1946,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 : (string) rand(); $placeholder = '{' . hash_hmac( $algo, uniqid( $salt, true ), $salt ) . '}'; }