From 9c6aa84719d853d4e056a34c96f566828656e6e8 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Mon, 5 Mar 2012 00:51:47 +0000 Subject: [PATCH] (bug 34922) If rev_parent_id is null, then the character delta displayed on Special:Contributions is wrong. In that case instead just display "x bytes". Kind of sticks out, but better than a wrong number (possible alternative is just display no number at all) No release notes since issue introduced in 1.19 and I'm going to tag this commit for merging. --- includes/specials/SpecialContributions.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 9f08cc5a7d..36ec7103c6 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -792,9 +792,16 @@ class ContribsPager extends ReverseChronologicalPager { array( 'action' => 'history' ) ); - $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? $this->mParentLens[$row->rev_parent_id] : 0; - $chardiff = ' . . ' . ChangesList::showCharacterDifference( - $parentLen, $row->rev_len ) . ' . . '; + if ( $row->rev_parent_id === null ) { + // For some reason rev_parent_id isn't populated for this row. + // Its rumoured this is true on wikipedia for some revisions (bug 34922). + // Next best thing is to have the total number of bytes. + $chardiff = ' . . ' . Linker::formatRevisionSize( $row->rev_len ) . ' . . '; + } else { + $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? $this->mParentLens[$row->rev_parent_id] : 0; + $chardiff = ' . . ' . ChangesList::showCharacterDifference( + $parentLen, $row->rev_len ) . ' . . '; + } $lang = $this->getLanguage(); $comment = $lang->getDirMark() . Linker::revComment( $rev, false, true ); -- 2.20.1