From: Alexandre Emsenhuber Date: Fri, 4 Mar 2011 20:16:35 +0000 (+0000) Subject: * (bug 27763) Article::getParserOutput() no longer throws a fatal given when an incor... X-Git-Tag: 1.31.0-rc.0~31648 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=0c99ecc6f2bda2ba9b7b74e5d1e248a5ad0b4b9d;p=lhc%2Fweb%2Fwiklou.git * (bug 27763) Article::getParserOutput() no longer throws a fatal given when an incorrect revision ID is passed --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 73cddf87b1..c5ff31984e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -155,6 +155,8 @@ PHP if you have not done so prior to upgrading MediaWiki. double HTML escaped * (bug 27700) The upload protection can now also be set for files that do not exist. +* (bug 27763) Article::getParserOutput() no longer throws a fatal given when an + incorrect revision ID is passed. === API changes in 1.18 === * (bug 26339) Throw warning when truncating an overlarge API result diff --git a/includes/Article.php b/includes/Article.php index 9512ce1f18..85226be885 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -4560,19 +4560,26 @@ class Article { wfIncrStats( 'pcache_miss_stub' ); } - $parserOutput = false; if ( $useParserCache ) { $parserOutput = ParserCache::singleton()->get( $this, $this->getParserOptions() ); + if ( $parserOutput !== false ) { + return $parserOutput; + } } - if ( $parserOutput === false ) { - // Cache miss; parse and output it. + $text = false; + // Cache miss; parse and output it. + if ( $oldid !== null ) { $rev = Revision::newFromTitle( $this->getTitle(), $oldid ); - - return $this->getOutputFromWikitext( $rev->getText(), $useParserCache ); - } else { - return $parserOutput; + if ( $rev !== null ) { + $text = $rev->getText(); + } } + if ( $text === false ) { + $text = $this->getRawText(); + } + + return $this->getOutputFromWikitext( $text, $useParserCache ); } }