From: Roan Kattouw Date: Wed, 8 Apr 2015 21:55:44 +0000 (-0700) Subject: ApiParse: Replace isCurrent() check with getLatest() comparison X-Git-Tag: 1.31.0-rc.0~11774 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=015c90fbf987e861afe031d094be3c6f4c84f138;p=lhc%2Fweb%2Fwiklou.git 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 --- 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'] ) );