Skip to content

Commit

Permalink
Code Modernisation: Document when the Hash polyfills can be removed.
Browse files Browse the repository at this point in the history
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.



git-svn-id: https://develop.svn.wordpress.org/trunk@45638 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
pento committed Jul 15, 2019
1 parent 593c402 commit e6c750b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/wp-includes/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ function _mb_strlen( $str, $encoding = null ) {
/**
* 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
*
Expand Down Expand Up @@ -335,10 +342,15 @@ function _json_decode_object_helper( $data ) {
*
* 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.
Expand Down

0 comments on commit e6c750b

Please sign in to comment.