From bd45c7d3b92cb1912d0c8f7a53937dbf6be564ba Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 15 Jul 2019 05:14:55 +0000 Subject: [PATCH] Code Modernisation: Document when the Hash polyfills can be removed. The Hash extension cannot be disabled as of PHP 7.4. So, while we can't remove these polyfills yet, we can document when we'll be able to. Props jrf. Fixes #47698. Built from https://develop.svn.wordpress.org/trunk@45638 git-svn-id: http://core.svn.wordpress.org/trunk@45449 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/compat.php | 16 ++++++++++++++-- wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/wp-includes/compat.php b/wp-includes/compat.php index e32b6efe97..9632afc842 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -221,6 +221,13 @@ if ( ! function_exists( 'hash_hmac' ) ) : /** * Compat function to mimic hash_hmac(). * + * The Hash extension is bundled with PHP by default since PHP 5.1.2. + * However, the extension may be explicitly disabled on select servers. + * As of PHP 7.4.0, the Hash extension is a core PHP extension and can no + * longer be disabled. + * I.e. when PHP 7.4.0 becomes the minimum requirement, this polyfill + * and the associated `_hash_hmac()` function can be safely removed. + * * @ignore * @since 3.2.0 * @@ -335,10 +342,15 @@ if ( ! function_exists( 'hash_equals' ) ) : * * Compares two strings using the same time whether they're equal or not. * - * This function was added in PHP 5.6. - * * Note: It can leak the length of a string when arguments of differing length are supplied. * + * This function was added in PHP 5.6. + * However, the Hash extension may be explicitly disabled on select servers. + * As of PHP 7.4.0, the Hash extension is a core PHP extension and can no + * longer be disabled. + * I.e. when PHP 7.4.0 becomes the minimum requirement, this polyfill + * can be safely removed. + * * @since 3.9.2 * * @param string $a Expected string. diff --git a/wp-includes/version.php b/wp-includes/version.php index c433c7f622..1a5e5afc20 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45637'; +$wp_version = '5.3-alpha-45638'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.