* (bug 27763) Article::getParserOutput() no longer throws a fatal given when an incor...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 4 Mar 2011 20:16:35 +0000 (20:16 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 4 Mar 2011 20:16:35 +0000 (20:16 +0000)
RELEASE-NOTES
includes/Article.php

index 73cddf8..c5ff319 100644 (file)
@@ -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
index 9512ce1..85226be 100644 (file)
@@ -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 );
        }
 
 }