Seb35 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404167 )

Change subject: Error when displaying a blank page
......................................................................

Error when displaying a blank page

When the content is set to blank for unapproved revisions, an error
was displayed instead since MediaWiki 1.31-alpha.

Bug: T18487
Change-Id: Idb16ca46f3a1ee7dd32c3925d9a985d0ba8193a3
---
M ApprovedRevs.hooks.php
1 file changed, 3 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ApprovedRevs 
refs/changes/67/404167/1

diff --git a/ApprovedRevs.hooks.php b/ApprovedRevs.hooks.php
index 6d35378..4f6097f 100644
--- a/ApprovedRevs.hooks.php
+++ b/ApprovedRevs.hooks.php
@@ -203,7 +203,7 @@
                return true;
        }
 
-       public static function showBlankIfUnapproved( &$article, &$content ) {
+       public static function showBlankIfUnapproved( &$article, Content 
&$content ) {
                global $egApprovedRevsBlankIfUnapproved;
                if ( ! $egApprovedRevsBlankIfUnapproved ) {
                        return true;
@@ -236,16 +236,7 @@
                ApprovedRevs::addCSS();
 
                // Set the content to blank.
-               // There's possibly a bug in MW 1.28, where the second argument
-               // (called from the hook 'ArticleAfterFetchContentObject') is
-               // sometimes (or always?) a string, instead of a Content object.
-               // We'll just get around it here with a check. (In theory, 
$content
-               // could also be null, so this check is a good idea anyway.)
-               if ( is_object( $content ) ) {
-                       $content->mText = '';
-               } else {
-                       $content = '';
-               }
+               $content = new WikitextContent( '' );
 
                return true;
        }
@@ -950,4 +941,4 @@
                $qp['SpecialApprovedRevsPage'] = 'ApprovedRevs';
                return true;
        }
-}
\ No newline at end of file
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/404167
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb16ca46f3a1ee7dd32c3925d9a985d0ba8193a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: Seb35 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to