jenkins-bot has submitted this change and it was merged.

Change subject: Unstub $wgLang before passing to AutoCommentFormatter
......................................................................


Unstub $wgLang before passing to AutoCommentFormatter

Occasionally $wgLang is an instance of StubUserLang
instead of Language.

As with T107711, this might happen in combination with
AbuseFilter, though not sure and thus added some
logging for this so we can get some more information
about this.

'wikibase-debug' is already available as a generic
debug log for Wikibase, in production.

Bug: T112070
Change-Id: I1023c48f20137122979a85408546ff66bfc6ba34
(cherry picked from commit f91e4f38aebf285cd939fe67d41aaa21c25ba142)
---
M repo/Wikibase.hooks.php
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  Aude: Looks good to me, approved
  Adrian Lang: Looks good to me, but someone else must approve
  Jeroen De Dauw: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index 1623431..ff3bdf2 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -14,6 +14,7 @@
 use Linker;
 use LogEntryBase;
 use MWException;
+use MWExceptionHandler;
 use OutputPage;
 use ParserOutput;
 use RecentChange;
@@ -23,6 +24,7 @@
 use Skin;
 use SkinTemplate;
 use SpecialSearch;
+use StubUserLang;
 use Title;
 use User;
 use Wikibase\Lib\AutoCommentFormatter;
@@ -820,6 +822,17 @@
                        return;
                }
 
+               if ( $wgLang instanceof StubUserLang ) {
+                       wfDebugLog(
+                               'wikibase-debug',
+                               'Bug: T112070: ' . 
MWExceptionHandler::prettyPrintTrace(
+                                       MWExceptionHandler::redactTrace( 
debug_backtrace() )
+                               )
+                       );
+
+                       StubUserLang::unstub( $wgLang );
+               }
+
                $formatter = new AutoCommentFormatter( $wgLang, $messagePrefix 
);
                $formattedComment = $formatter->formatAutoComment( $auto );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1023c48f20137122979a85408546ff66bfc6ba34
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: wmf/1.26wmf22
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Adrian Lang <adrian.he...@wikimedia.de>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to