Page MenuHomePhabricator

Catchable fatal error: Argument 2 passed to EchoDiscussionParser::getTextSnippet() must be an instance of Language, StubUserLang given
Closed, ResolvedPublic

Description

[18:23:39] <Krinkle> legoktm: RoanKattouw: btw, just checking, exceptions had a spike earlier from Echo maintenance script (Catchable fatal about arg passed to EchoDiscussionParser::getTextSnippet)
[18:23:48] <Krinkle> resolved/known?
[18:23:54] <RoanKattouw> Which maintenance script?
[18:23:59] <legoktm> not known, which script?
[18:24:03] <Krinkle> processEchoEmailBatch
[18:24:08] <Krinkle> Started 1.5h ago
[18:24:10] <Krinkle> and then stoped
[18:24:20] <Krinkle> https://logstash.wikimedia.org/#dashboard/temp/AVD-qF4GptxhN1XaZJGX
[18:24:21] <RoanKattouw> Not known to me either
[18:24:42] <RoanKattouw> Catchable fatal error: Argument 2 passed to EchoDiscussionParser::getTextSnippet() must be an instance of Language, StubUserLang given
[18:24:53] <RoanKattouw> Some sort of strange unstubbing bug?
[18:25:03] <RoanKattouw> Oh, type hints probably don't play well with stubbing

Event Timeline

Legoktm raised the priority of this task from to Needs Triage.
Legoktm updated the task description. (Show Details)
Legoktm added subscribers: Legoktm, Catrope, Krinkle.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald Transcript
km@km-tp ~/p/v/m/e/Echo> ack "Language \\\$"
includes/DataOutputFormatter.php
21:	 * @param Language $lang Language to format the notification in
24:	public static function formatOutput( EchoNotification $notification, $format = false, User $user, Language $lang ) {
128:	 * @param Language $lang

includes/formatters/EchoEventFormatter.php
15:	public function __construct( User $user, Language $language ) {

includes/DiscussionParser.php
830:	 * @param Language $lang
834:	static function getTextSnippet( $text, Language $lang, $length = 150 ) {

Change 253362 had a related patch set uploaded (by Legoktm):
Unstub $wgLang before passing it to DiscussionParser::getTextSnippet()

https://gerrit.wikimedia.org/r/253362

includes/DataOutputFormatter.php
21:	 * @param Language $lang Language to format the notification in
24:	public static function formatOutput( EchoNotification $notification, $format = false, User $user, Language $lang ) {
128:	 * @param Language $lang

includes/formatters/EchoEventFormatter.php
15:	public function __construct( User $user, Language $language ) {

Both of these are safe because Language is coming from RequestContext::getLanguage() which won't return StubUserLang (only $wgLang can).

Change 253362 merged by jenkins-bot:
Unstub $wgLang before passing it to DiscussionParser::getTextSnippet()

https://gerrit.wikimedia.org/r/253362

Legoktm claimed this task.

Change 254339 had a related patch set uploaded (by Legoktm):
Remove problematic Language type-hint from getTextSnippet()

https://gerrit.wikimedia.org/r/254339

Still happening apparently.

Change 254339 merged by jenkins-bot:
Unstub $wgLang in BasicFormatter::getLanguage() too

https://gerrit.wikimedia.org/r/254339

Change 254345 had a related patch set uploaded (by Catrope):
Unstub $wgLang in BasicFormatter::getLanguage() too

https://gerrit.wikimedia.org/r/254345

Change 254345 merged by jenkins-bot:
Unstub $wgLang in BasicFormatter::getLanguage() too

https://gerrit.wikimedia.org/r/254345