Revision::getSize() might return null when the revision.rev_len field
is null. That should never happen normally (the field should get
backfilled as part of the update process), but we've also had a bug
where rev_len was not being recorded for empty pages (see T135414 for
details). It's saner to return a number here rather than empty string,
and 0 should actually be correct for all pages affected by that issue.
Bug: T20998
Change-Id: Ie12f0be24f00aaf8b90b25c4921a97df3b789369
// fetch revision from cache/database and return the value
$rev = self::getCachedRevisionObject( $parser, $title );
$length = $rev ? $rev->getSize() : 0;
+ if ( $length === null ) {
+ // We've had bugs where rev_len was not being recorded for empty pages, see T135414
+ $length = 0;
+ }
return self::formatRaw( $length, $raw );
}