diff options
author | Kevin Israel <pleasestand@live.com> | 2022-05-30 21:08:49 -0400 |
---|---|---|
committer | Kevin Israel <pleasestand@live.com> | 2022-05-31 00:11:27 -0400 |
commit | 7cf5121226a3938ae02ed4560aa3080919dcb186 (patch) | |
tree | 2b98b34f8f531d1acc8bed505ca94d9a07209753 | |
parent | d160b616f3dc19833e3d0a70bedbe453219cab2f (diff) | |
download | mediawikicore-7cf5121226a3938ae02ed4560aa3080919dcb186.tar.gz mediawikicore-7cf5121226a3938ae02ed4560aa3080919dcb186.zip |
DiffHistoryBlob: Don't check for hash PHP extension
MediaWiki has required this PHP extension for quite a while by now.
Furthermore, it is always available in PHP 7.4 and later.
Change-Id: Ifbf3400bca75351ea8fa461ca27259ee31543237
-rw-r--r-- | includes/historyblob/DiffHistoryBlob.php | 10 | ||||
-rw-r--r-- | tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php | 2 |
2 files changed, 3 insertions, 9 deletions
diff --git a/includes/historyblob/DiffHistoryBlob.php b/includes/historyblob/DiffHistoryBlob.php index 3330ffa95bdd..bc1c3a083622 100644 --- a/includes/historyblob/DiffHistoryBlob.php +++ b/includes/historyblob/DiffHistoryBlob.php @@ -220,9 +220,9 @@ class DiffHistoryBlob implements HistoryBlob { $header = unpack( 'Vofp/Vcsize', substr( $diff, 0, 8 ) ); - # Check the checksum if hash extension is available + # Check the checksum $ofp = $this->xdiffAdler32( $base ); - if ( $ofp !== false && $ofp !== substr( $diff, 0, 4 ) ) { + if ( $ofp !== substr( $diff, 0, 4 ) ) { wfDebug( __METHOD__ . ": incorrect base checksum" ); return false; } @@ -268,13 +268,9 @@ class DiffHistoryBlob implements HistoryBlob { * the bytes backwards and initialised with 0 instead of 1. See T36428. * * @param string $s - * @return string|bool False if the hash extension is not available + * @return string */ public function xdiffAdler32( $s ) { - if ( !function_exists( 'hash' ) ) { - return false; - } - static $init; if ( $init === null ) { $init = str_repeat( "\xf0", 205 ) . "\xee" . str_repeat( "\xf0", 67 ) . "\x02"; diff --git a/tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php b/tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php index 4a90400911ca..c7fb4106040a 100644 --- a/tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php +++ b/tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php @@ -4,8 +4,6 @@ class DiffHistoryBlobTest extends MediaWikiUnitTestCase { protected function setUp(): void { parent::setUp(); - - $this->checkPHPExtension( 'hash' ); $this->checkPHPExtension( 'xdiff' ); if ( !function_exists( 'xdiff_string_rabdiff' ) ) { |