Page MenuHomePhabricator

Undefined index: . at Language.php:3348
Closed, ResolvedPublic

Description

[2020-11-02 20:35:15] error.ERROR: [c606cf955e3f857042f600f9] /w/i.php?oldid=4834466&title=Translating%3AIntro%2Fla   ErrorException from line 3348 of /srv/mediawiki/tags/2020-10-28_15:12:22/languages/Language.php
: PHP Notice: Undefined index: . {"exception":"[object] (ErrorException(code: 0): PHP Notice: Undefined index: . at /srv/mediawiki/tags/2020-10-28_15:12:22/languages/Language.php:3348)
[stacktrace]
#0 /srv/mediawiki/tags/2020-10-28_15:12:22/languages/Language.php(3348): MWExceptionHandler::handleError(8, 'Undefined index...', '/srv/mediawiki/...', 3348, Array)
#1 /srv/mediawiki/tags/2020-10-28_15:12:22/languages/Language.php(3265): Language->formatNumInternal('1', false, false)
#2 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/parser/Parser.php(4218): Language->formatNum(1)
#3 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/parser/Parser.php(1583): Parser->finalizeHeadings('\\x7F'\"`UNIQ--langu...', '<languages />\
{...', true)
#4 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/parser/Parser.php(646): Parser->internalParse('\\x7F'\"`UNIQ--langu...')
#5 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/content/WikitextContent.php(375): Parser->parse('<languages />\
{...', Object(Title), Object(ParserOptions), true, true, 4834466)
#6 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/content/AbstractContent.php(590): WikitextContent->fillParserOutput(Object(Title), 4834466, Object(ParserOptions), true, Object(ParserOutput))
#7 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/Revision/RenderedRevision.php(263): AbstractContent->getParserOutput(Object(Title), 4834466, Object(ParserOptions), true)
#8 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/Revision/RenderedRevision.php(235): MediaWiki\\Revision\\RenderedRevision->getSlotParserOutputUncached(Object(WikitextContent), true)
#9 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/Revision/RevisionRenderer.php(215): MediaWiki\\Revision\\RenderedRevision->getSlotParserOutput('main', Array)
#10 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/Revision/RevisionRenderer.php(152): MediaWiki\\Revision\\RevisionRenderer->combineSlotOutput(Object(MediaWiki\\Revision\\RenderedRevision), Array)
#11 [internal function]: MediaWiki\\Revision\\RevisionRenderer->MediaWiki\\Revision\\{closure}(Object(MediaWiki\\Revision\\RenderedRevision), Array)
#12 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/Revision/RenderedRevision.php(197): call_user_func(Object(Closure), Object(MediaWiki\\Revision\\RenderedRevision), Array)
#13 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/poolcounter/PoolWorkArticleView.php(215): MediaWiki\\Revision\\RenderedRevision->getRevisionParserOutput()
#14 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#15 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/page/Article.php(811): PoolCounterWork->execute()
#16 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/actions/ViewAction.php(74): Article->view()
#17 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/MediaWiki.php(530): ViewAction->show()
#18 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/MediaWiki.php(316): MediaWiki->performAction(Object(Article), Object(Title))
#19 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/MediaWiki.php(943): MediaWiki->performRequest()
#20 /srv/mediawiki/tags/2020-10-28_15:12:22/includes/MediaWiki.php(546): MediaWiki->main()
#21 /srv/mediawiki/tags/2020-10-28_15:12:22/index.php(53): MediaWiki->run()
#22 /srv/mediawiki/tags/2020-10-28_15:12:22/index.php(46): wfIndexMain()
#23 {main}
","exception_id":"c606cf955e3f857042f600f9","exception_url":"/w/i.php?oldid=4834466&title=Translating%3AIntro%2Fla","caught_by":"mwe_handler"} []

Search reveals that en has this variable set to null, km is missing , and la is missing .

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptTue, Nov 3, 6:43 AM

Adding as a train blocker since this can be very spammy once it reaches those wikis.

brennen triaged this task as Unbreak Now! priority.Wed, Nov 4, 3:59 PM
brennen added a subscriber: brennen.

Marking as UBN!, since this is a train blocker.

In that area, recently rMWce8d0e9599a84565d53965481d1c163a90c4e6dd got committed for T167088. CC'ing authors/reviewers.

In that area, recently rMWce8d0e9599a84565d53965481d1c163a90c4e6dd got committed for T167088. CC'ing authors/reviewers.

@cscott does ^ account for this problem?

cscott added a comment.Wed, Nov 4, 8:46 PM

Looking...

cscott added a comment.EditedWed, Nov 4, 8:53 PM

Um, can someone more familiar with the ways of PHP explain why isset($m[2]) would display a PHP warning if $m[2] doesn't exist? Shouldn't isset always suppress that warning?

The context lines are:

				if ( preg_match( '/^-?(\d*)(\.(\d*))?$/', $number, $m ) ) {
					$fmt->setAttribute( NumberFormatter::MIN_INTEGER_DIGITS, strlen( $m[1] ) );
					if ( isset( $m[2] ) ) {
						$fmt->setAttribute( NumberFormatter::DECIMAL_ALWAYS_SHOWN, true );
					}
					$fmt->setAttribute( NumberFormatter::FRACTION_DIGITS, strlen( $m[3] ?? '' ) );
				}

and $number seems to be "1" here.

I'm not sure why @Nikerabbit thinks $separatorTransformTable is in play, probably we're looking at different revisions of the file? But I'm looking at line 3348 of Language.php in wmf/1.36.0-wmf.16. @Nikerabbit can you explain what version you were testing?

[EDIT: assuming @Nikerabbit's diagnosis of the undefined index in $separatorTransformTable is correct even though our line numbers don't match up. From my investigation below I'm assuming that the language involved must have been la. Let me know if you can trigger this on some other language...)

cscott added a comment.EditedWed, Nov 4, 9:15 PM

Note that km should never get here because LanguageKm overrides formatNum so formatNumInternal will never get called. la will get here, though, and it would generate the message for index . which is in the stack trace. Patch incoming to fix this. Not sure it is *really* UBN given that it seems to affect only a single wiki in a dead language with 134,045 articles, but easy enough to fix... (EDIT: I guess @Nikerabbit is saying it affects translatewiki?)

Change 639289 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] language: Clean up $separatorTransformTable in km/la/my

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

I am not sure why you are getting completely different lines of code... the stack trace is from translatewiki.net. Here is what it points to:

3339                         } else {
3340                                 // NumberFormatter supports separator transformation,
3341                                 // but it does not know all languages MW
3342                                 // supports. Example: arq. Also, languages like pl has
3343                                 // customisation.  So manually set it.
3344                                 if ( $noTranslate ) {
3345                                         $fmt->setSymbol( NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, '.' );
3346                                         $fmt->setSymbol( NumberFormatter::GROUPING_SEPARATOR_SYMBOL, ',' );
3347                                 } elseif ( $separatorTransformTable ) {
3348                                         $fmt->setSymbol( NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, $separatorTransformTable[ '.' ] );
3349                                         $fmt->setSymbol( NumberFormatter::GROUPING_SEPARATOR_SYMBOL, $separatorTransformTable[ ',' ] );
3350                                 }

Change 639289 merged by jenkins-bot:
[mediawiki/core@master] language: Clean up $separatorTransformTable in km/la/my

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

Change 639491 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@wmf/1.36.0-wmf.16] language: Clean up $separatorTransformTable in km/la/my

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

cscott closed this task as Resolved.Thu, Nov 5, 2:32 PM
cscott claimed this task.

Cherry-picked to 1.36.0-wmf.16, closing.

Change 639491 merged by jenkins-bot:
[mediawiki/core@wmf/1.36.0-wmf.16] language: Clean up $separatorTransformTable in km/la/my

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

Mentioned in SAL (#wikimedia-operations) [2020-11-05T17:26:34Z] <brennen@deploy1001> Synchronized php-1.36.0-wmf.16/languages: Backport: [[gerrit:639491|language: Clean up $separatorTransformTable in km/la/my (T267091)]] (duration: 01m 12s)

brennen reopened this task as Open.Thu, Nov 5, 5:59 PM

After deploy to group0, got a steady trickle of these:

Use of Language::formatNum with a non-numeric string was deprecated in MediaWiki 1.36. [Called from Language::formatNum]
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /srv/mediawiki/php-1.36.0-wmf.16/includes/debug/MWDebug.php(329): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.36.0-wmf.16/includes/debug/MWDebug.php(305): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /srv/mediawiki/php-1.36.0-wmf.16/includes/debug/MWDebug.php(234): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /srv/mediawiki/php-1.36.0-wmf.16/includes/GlobalFunctions.php(1029): MWDebug::deprecated(string, string, string, integer)
#5 /srv/mediawiki/php-1.36.0-wmf.16/languages/Language.php(3286): wfDeprecated(string, string)
#6 /srv/mediawiki/php-1.36.0-wmf.16/languages/Language.php(3265): Language->formatNumInternal(string, boolean, boolean)
#7 /srv/mediawiki/php-1.36.0-wmf.16/includes/language/Message.php(1176): Language->formatNum(string)
#8 /srv/mediawiki/php-1.36.0-wmf.16/includes/language/Message.php(1140): Message->extractParam(array, string)
#9 /srv/mediawiki/php-1.36.0-wmf.16/includes/language/Message.php(872): Message->replaceParameters(string, string, string)
#10 /srv/mediawiki/php-1.36.0-wmf.16/includes/language/Message.php(941): Message->toString(string)
#11 /srv/mediawiki/php-1.36.0-wmf.16/extensions/CentralAuth/includes/specials/SpecialCentralAuth.php(754): Message->text()
#12 /srv/mediawiki/php-1.36.0-wmf.16/extensions/CentralAuth/includes/specials/SpecialCentralAuth.php(521): SpecialCentralAuth->formatEditcount(array)
#13 [internal function]: SpecialCentralAuth->listWikiItem(array)
#14 /srv/mediawiki/php-1.36.0-wmf.16/extensions/CentralAuth/includes/specials/SpecialCentralAuth.php(480): array_map(array, array)
#15 /srv/mediawiki/php-1.36.0-wmf.16/extensions/CentralAuth/includes/specials/SpecialCentralAuth.php(412): SpecialCentralAuth->listAccounts(array)
#16 /srv/mediawiki/php-1.36.0-wmf.16/extensions/CentralAuth/includes/specials/SpecialCentralAuth.php(168): SpecialCentralAuth->showWikiLists()
#17 /srv/mediawiki/php-1.36.0-wmf.16/includes/specialpage/SpecialPage.php(607): SpecialCentralAuth->execute(string)
#18 /srv/mediawiki/php-1.36.0-wmf.16/includes/specialpage/SpecialPageFactory.php(1168): SpecialPage->run(string)
#19 /srv/mediawiki/php-1.36.0-wmf.16/includes/MediaWiki.php(310): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#20 /srv/mediawiki/php-1.36.0-wmf.16/includes/MediaWiki.php(943): MediaWiki->performRequest()
#21 /srv/mediawiki/php-1.36.0-wmf.16/includes/MediaWiki.php(546): MediaWiki->main()
#22 /srv/mediawiki/php-1.36.0-wmf.16/index.php(53): MediaWiki->run()
#23 /srv/mediawiki/php-1.36.0-wmf.16/index.php(46): wfIndexMain()
#24 /srv/mediawiki/w/index.php(3): require(string)
#25 {main}

Unintended side effect of change here, or totally unrelated?

cscott added a comment.Thu, Nov 5, 6:13 PM

@brennen vaguely, as in same set of patches involved, but the above log is a case of T263592: Use of Language::commafy with a non-numeric string was deprecated in MediaWiki 1.36. [Called from Language::formatNum]. (T266677 was forked off that task for the set of issues related to FormatNum, but this is a different issue). I'll open a new task.