From 015c90fbf987e861afe031d094be3c6f4c84f138 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 8 Apr 2015 14:55:44 -0700 Subject: [PATCH] ApiParse: Replace isCurrent() check with getLatest() comparison Because the $pageObj state is what actually ends up getting used. If $pageObj thinks an old rev is the latest one, then we are in trouble, even if $rev knows what's really going on. Bug: T95466 Change-Id: I4d6ba4f18adaaad052d3bee1a575ba034aaf112b --- includes/api/ApiParse.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 73bea83378..b565dea873 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -107,7 +107,10 @@ class ApiParse extends ApiBase { $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'] ) ); -- 2.20.1