Make WordPress Core

Ticket #47698: 47698-patch-3-enhance-documentation-hash-polyfills.patch

File 47698-patch-3-enhance-documentation-hash-polyfills.patch, 1.7 KB (added by jrf, 5 years ago)
  • src/wp-includes/compat.php

    From c3fdb560dff79070aac19686b02eb262bc83ea49 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Fri, 12 Jul 2019 06:15:39 +0200
    Subject: [PATCH] Document when the Hash extension polyfills can be removed
    
    ---
     src/wp-includes/compat.php | 16 ++++++++++++++--
     1 file changed, 14 insertions(+), 2 deletions(-)
    
    diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php
    index f208887d5d..c11e2d51a9 100644
    a b if ( ! function_exists( 'hash_hmac' ) ) : 
    221221        /**
    222222         * Compat function to mimic hash_hmac().
    223223         *
     224         * The Hash extension is bundled with PHP by default since PHP 5.1.2.
     225         * However, the extension may be explicitly disabled on select servers.
     226         * As of PHP 7.4.0, the Hash extension is a core PHP extension and can no
     227         * longer be disabled.
     228         * I.e. when PHP 7.4.0 becomes the minimum requirement, this polyfill
     229         * and the associated `_hash_hmac()` function can be safely removed.
     230         *
    224231         * @ignore
    225232         * @since 3.2.0
    226233         *
    if ( ! function_exists( 'hash_equals' ) ) : 
    288295         *
    289296         * Compares two strings using the same time whether they're equal or not.
    290297         *
    291          * This function was added in PHP 5.6.
    292          *
    293298         * Note: It can leak the length of a string when arguments of differing length are supplied.
    294299         *
     300         * This function was added in PHP 5.6.
     301         * However, the Hash extension may be explicitly disabled on select servers.
     302         * As of PHP 7.4.0, the Hash extension is a core PHP extension and can no
     303         * longer be disabled.
     304         * I.e. when PHP 7.4.0 becomes the minimum requirement, this polyfill
     305         * can be safely removed.
     306         *
    295307         * @since 3.9.2
    296308         *
    297309         * @param string $a Expected string.