From 24584cab86134d8e7c4bc81657bffbb100a001da Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Mon, 24 Dec 2012 03:20:06 -0400 Subject: [PATCH] (bug 43379) History page fail gracefully if rev_len unavailable If the length of a revision is unavailable, do not show the page size (or char difference) instead of pretending it is 0 and showing wrong info. Change-Id: I2b2ca3da480e9222911ff6a91f3ab1ca4a8b9ba1 --- includes/actions/HistoryAction.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 61de3b6328..d68ae2b5a7 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -602,13 +602,16 @@ class HistoryPager extends ReverseChronologicalPager { $s .= ' ' . ChangesList::flag( 'minor' ); } - # Size is always public data - $prevSize = isset( $this->parentLens[$row->rev_parent_id] ) - ? $this->parentLens[$row->rev_parent_id] - : 0; - $sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() ); - $fSize = Linker::formatRevisionSize($rev->getSize()); - $s .= ' . . ' . "$fSize $sDiff"; + # Sometimes rev_len isn't populated + if ( $rev->getSize() !== null ) { + # Size is always public data + $prevSize = isset( $this->parentLens[$row->rev_parent_id] ) + ? $this->parentLens[$row->rev_parent_id] + : 0; + $sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() ); + $fSize = Linker::formatRevisionSize($rev->getSize()); + $s .= ' . . ' . "$fSize $sDiff"; + } # Text following the character difference is added just before running hooks $s2 = Linker::revComment( $rev, false, true ); -- 2.20.1