diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/parser/CoreParserFunctions.php | 4 | ||||
-rw-r--r-- | includes/parser/Parser.php | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 427c8ca7857c..a96d873a3b62 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -1394,9 +1394,7 @@ class CoreParserFunctions { } // fetch revision from cache/database and return the value $rev = self::getCachedRevisionObject( $parser, $t, 'vary-user' ); - - // TODO what can getCachedRevisionObject return other than RevisionRecord and null - if ( !( $rev instanceof RevisionRecord ) ) { + if ( $rev === null ) { return ''; } $user = $rev->getUser(); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index e9698527167e..92c0c2df4659 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -5778,6 +5778,14 @@ class Parser { $this ); + if ( $rev === false ) { + // The revision record callback returns `false` (not null) to + // indicate that the revision is missing. (See for example + // Parser::statelessFetchRevisionRecord(), the default callback.) + // This API expects `null` instead. (T251952) + $rev = null; + } + if ( $this->mRevisionId === null && $rev && $rev->getId() ) { // We are in preview mode (mRevisionId is null), and the current revision callback // returned an existing revision. Ignore it and return null, it's probably the page's |