$popts = $this->makeParserOptions( $pageObj, $params );
// If for some reason the "oldid" is actually the current revision, it may be cached
- if ( $rev->isCurrent() ) {
+ // Deliberately comparing $pageObj->getLatest() with $rev->getId(), rather than
+ // checking $rev->isCurrent(), because $pageObj is what actually ends up being used,
+ // and if its ->getLatest() is outdated, $rev->isCurrent() won't tell us that.
+ if ( $rev->getId() == $pageObj->getLatest() ) {
// May get from/save to parser cache
$p_result = $this->getParsedContent( $pageObj, $popts,
$pageid, isset( $prop['wikitext'] ) );