DifferenceEngine: Allow cache hits for empty diffs
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 19 Feb 2019 20:54:33 +0000 (15:54 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 19 Feb 2019 20:55:44 +0000 (15:55 -0500)
PHP considers the empty string as falsey, so check for a string
result instead.

Bug: T216554
Change-Id: I3b7d1199acbfede8a95761c5cb1c797b9a3d64cb

includes/diff/DifferenceEngine.php

index 43bc6e4..87863a4 100644 (file)
@@ -1033,7 +1033,7 @@ class DifferenceEngine extends ContextSource {
                        // Try cache
                        if ( !$this->mRefreshCache ) {
                                $difftext = $cache->get( $key );
-                               if ( $difftext ) {
+                               if ( is_string( $difftext ) ) {
                                        wfIncrStats( 'diff_cache.hit' );
                                        $difftext = $this->localiseDiff( $difftext );
                                        $difftext .= "\n<!-- diff cache key $key -->\n";