aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Israel <pleasestand@live.com>2022-05-30 22:24:25 -0400
committerKevin Israel <pleasestand@live.com>2022-05-31 00:11:27 -0400
commitae0fc3b02f3c3a13cedd8e30194335c6b093b727 (patch)
tree0468c952bd194602dff82bcde724b9a777165469
parent7cf5121226a3938ae02ed4560aa3080919dcb186 (diff)
downloadmediawikicore-ae0fc3b02f3c3a13cedd8e30194335c6b093b727.tar.gz
mediawikicore-ae0fc3b02f3c3a13cedd8e30194335c6b093b727.zip
DiffHistoryBlob: Remove workarounds for old PECL xdiff versions
Versions of PECL xdiff older than 1.5.2 cannot be compiled against PHP 5.4 and newer (we require PHP 7.2+). See changelog: https://pecl.php.net/package-changelog.php?package=xdiff Change-Id: I28d27fd3bbac6a42827a2b46f06f25657023cc10
-rw-r--r--includes/historyblob/DiffHistoryBlob.php18
-rw-r--r--tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php4
2 files changed, 4 insertions, 18 deletions
diff --git a/includes/historyblob/DiffHistoryBlob.php b/includes/historyblob/DiffHistoryBlob.php
index bc1c3a083622..feddbf6a41cf 100644
--- a/includes/historyblob/DiffHistoryBlob.php
+++ b/includes/historyblob/DiffHistoryBlob.php
@@ -20,11 +20,9 @@
* @file
*/
-use Wikimedia\AtEase\AtEase;
-
/**
* Diff-based history compression
- * Requires xdiff 1.5+ and zlib
+ * Requires xdiff and zlib
*/
class DiffHistoryBlob implements HistoryBlob {
/** @var string[] Uncompressed item cache */
@@ -119,7 +117,7 @@ class DiffHistoryBlob implements HistoryBlob {
*/
private function compress() {
if ( !function_exists( 'xdiff_string_rabdiff' ) ) {
- throw new MWException( "Need xdiff 1.5+ support to write DiffHistoryBlob\n" );
+ throw new MWException( "Need xdiff support to write DiffHistoryBlob\n" );
}
if ( isset( $this->mDiffs ) ) {
// Already compressed
@@ -195,12 +193,7 @@ class DiffHistoryBlob implements HistoryBlob {
* @return string
*/
private function diff( $t1, $t2 ) {
- # Need to do a null concatenation with warnings off, due to bugs in the current version of xdiff
- # "String is not zero-terminated"
- AtEase::suppressWarnings();
- $diff = xdiff_string_rabdiff( $t1, $t2 ) . '';
- AtEase::restoreWarnings();
- return $diff;
+ return xdiff_string_rabdiff( $t1, $t2 );
}
/**
@@ -210,10 +203,7 @@ class DiffHistoryBlob implements HistoryBlob {
*/
private function patch( $base, $diff ) {
if ( function_exists( 'xdiff_string_bpatch' ) ) {
- AtEase::suppressWarnings();
- $text = xdiff_string_bpatch( $base, $diff ) . '';
- AtEase::restoreWarnings();
- return $text;
+ return xdiff_string_bpatch( $base, $diff );
}
# Pure PHP implementation
diff --git a/tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php b/tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php
index c7fb4106040a..e2929e7abfe2 100644
--- a/tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php
+++ b/tests/phpunit/unit/includes/historyblob/DiffHistoryBlobTest.php
@@ -5,10 +5,6 @@ class DiffHistoryBlobTest extends MediaWikiUnitTestCase {
protected function setUp(): void {
parent::setUp();
$this->checkPHPExtension( 'xdiff' );
-
- if ( !function_exists( 'xdiff_string_rabdiff' ) ) {
- $this->markTestSkipped( 'The version of xdiff extension is lower than 1.5.0' );
- }
}
/**