Page MenuHomePhabricator

Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $title: invalid name 'Map/13/50.707813888889/7.128569444444/ar--_or_'
Open, LowPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $title: invalid name 'Map/13/50.707813888889/7.128569444444/ar--_or_'
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.16/vendor/wikimedia/assert/src/Assert.php(72)
#0 /srv/mediawiki/php-1.37.0-wmf.16/includes/title/TitleValue.php(200): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.37.0-wmf.16/includes/title/TitleValue.php(164): TitleValue::assertValidSpec(integer, string, string, string)
#2 /srv/mediawiki/php-1.37.0-wmf.16/includes/specialpage/SpecialPage.php(126): TitleValue->__construct(integer, string, string)
#3 /srv/mediawiki/php-1.37.0-wmf.16/includes/specialpage/SpecialPage.php(109): SpecialPage::getTitleValueFor(string, string, string)
#4 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Kartographer/includes/SpecialMap.php(115): SpecialPage::getTitleFor(string, string)
#5 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Kartographer/includes/Tag/MapFrame.php(142): Kartographer\SpecialMap::link(double, double, integer, string)
#6 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Kartographer/includes/Tag/TagHandler.php(131): Kartographer\Tag\MapFrame->render()
#7 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Kartographer/includes/Tag/TagHandler.php(94): Kartographer\Tag\TagHandler->handle(string, array, Parser, PPFrame_Hash)
#8 /srv/mediawiki/php-1.37.0-wmf.16/includes/parser/Parser.php(3959): Kartographer\Tag\TagHandler::entryPoint(string, array, Parser, PPFrame_Hash)
#9 /srv/mediawiki/php-1.37.0-wmf.16/includes/parser/PPFrame_Hash.php(341): Parser->extensionSubstitution(array, PPFrame_Hash)
#10 /srv/mediawiki/php-1.37.0-wmf.16/includes/parser/Parser.php(2916): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#11 /srv/mediawiki/php-1.37.0-wmf.16/includes/parser/Parser.php(1584): Parser->replaceVariables(string)
#12 /srv/mediawiki/php-1.37.0-wmf.16/includes/parser/Parser.php(645): Parser->internalParse(string)
#13 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/lib/includes/Formatters/CachingKartographerEmbeddingHandler.php(129): Parser->parse(string, Title, ParserOptions, boolean, boolean)
#14 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/ParserOutput/GlobeCoordinateKartographerDataUpdater.php(77): Wikibase\Lib\Formatters\CachingKartographerEmbeddingHandler->getParserOutput(array, LanguageEn)
#15 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/ParserOutput/CompositeStatementDataUpdater.php(32): Wikibase\Repo\ParserOutput\GlobeCoordinateKartographerDataUpdater->updateParserOutput(ParserOutput)
#16 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/ParserOutput/ItemParserOutputUpdater.php(34): Wikibase\Repo\ParserOutput\CompositeStatementDataUpdater->updateParserOutput(ParserOutput)
#17 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/ParserOutput/ItemParserOutputUpdater.php(25): Wikibase\Repo\ParserOutput\ItemParserOutputUpdater->updateParserOutputForItem(ParserOutput, Wikibase\DataModel\Entity\Item)
#18 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/ParserOutput/EntityParserOutputDataUpdaterCollection.php(44): Wikibase\Repo\ParserOutput\ItemParserOutputUpdater->updateParserOutput(ParserOutput, Wikibase\DataModel\Entity\Item)
#19 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/ParserOutput/FullEntityParserOutputGenerator.php(138): Wikibase\Repo\ParserOutput\EntityParserOutputDataUpdaterCollection->updateParserOutput(Wikibase\DataModel\Entity\Item)
#20 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/ParserOutput/StatsdTimeRecordingEntityParserOutputGenerator.php(53): Wikibase\Repo\ParserOutput\FullEntityParserOutputGenerator->getParserOutput(Wikibase\Lib\Store\EntityRevision, boolean)
#21 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/Content/EntityContent.php(239): Wikibase\Repo\ParserOutput\StatsdTimeRecordingEntityParserOutputGenerator->getParserOutput(Wikibase\Lib\Store\EntityRevision, boolean)
#22 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/Content/ItemContent.php(234): Wikibase\Repo\Content\EntityContent->getParserOutputFromEntityView(integer, ParserOptions, boolean)
#23 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/Content/EntityContent.php(177): Wikibase\Repo\Content\ItemContent->getParserOutputFromEntityView(integer, ParserOptions, boolean)
#24 /srv/mediawiki/php-1.37.0-wmf.16/includes/Revision/RenderedRevision.php(266): Wikibase\Repo\Content\EntityContent->getParserOutput(Title, integer, ParserOptions, boolean)
#25 /srv/mediawiki/php-1.37.0-wmf.16/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(Wikibase\Repo\Content\ItemContent, boolean)
#26 /srv/mediawiki/php-1.37.0-wmf.16/includes/Revision/RevisionRenderer.php(217): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#27 /srv/mediawiki/php-1.37.0-wmf.16/includes/Revision/RevisionRenderer.php(154): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#28 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#29 /srv/mediawiki/php-1.37.0-wmf.16/includes/Revision/RenderedRevision.php(197): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#30 /srv/mediawiki/php-1.37.0-wmf.16/includes/poolcounter/PoolWorkArticleView.php(137): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#31 /srv/mediawiki/php-1.37.0-wmf.16/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#32 /srv/mediawiki/php-1.37.0-wmf.16/includes/page/ParserOutputAccess.php(281): PoolCounterWork->execute()
#33 /srv/mediawiki/php-1.37.0-wmf.16/includes/page/Article.php(747): MediaWiki\Page\ParserOutputAccess->getParserOutput(WikiPage, ParserOptions, MediaWiki\Revision\RevisionStoreCacheRecord, integer)
#34 /srv/mediawiki/php-1.37.0-wmf.16/includes/page/Article.php(559): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#35 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/Actions/ViewEntityAction.php(82): Article->view()
#36 /srv/mediawiki/php-1.37.0-wmf.16/extensions/Wikibase/repo/includes/Actions/ViewEntityAction.php(57): Wikibase\Repo\Actions\ViewEntityAction->showEntityPage()
#37 /srv/mediawiki/php-1.37.0-wmf.16/includes/MediaWiki.php(538): Wikibase\Repo\Actions\ViewEntityAction->show()
#38 /srv/mediawiki/php-1.37.0-wmf.16/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#39 /srv/mediawiki/php-1.37.0-wmf.16/includes/MediaWiki.php(925): MediaWiki->performRequest()
#40 /srv/mediawiki/php-1.37.0-wmf.16/includes/MediaWiki.php(559): MediaWiki->main()
#41 /srv/mediawiki/php-1.37.0-wmf.16/index.php(53): MediaWiki->run()
#42 /srv/mediawiki/php-1.37.0-wmf.16/index.php(46): wfIndexMain()
#43 /srv/mediawiki/w/index.php(3): require(string)
#44 {main}
Impact
Notes

Event Timeline

mmodell updated the task description. (Show Details)
Umherirrender subscribed.

The language provided by lang is validated with Language::isKnownLanguageTag in TagHandler::parseArgs, but the language by uselang results in Parser::getTargetLanguage and seems not validated.

That makes the fatal on linking with that language

Work around: https://www.wikidata.org/wiki/Q9396?uselang=ar

Link-valid, but falls back to en: https://www.wikidata.org/wiki/Q9396?uselang=ar--%20or

Looks like 6 occurrences in the past month, all on wikidatawiki

[{reqId}] {exception_url} Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $title: invalid name 'Map/13/50.707813888889/7.128569444444/ar--_or_'	4
[{reqId}] {exception_url} Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $title: invalid name 'Map/13/34.969722222222/135.75619444444/ar--_or_'	1
[{reqId}] {exception_url} Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $title: invalid name 'Map/13/37.376944444444/-121.92277777778/ar--_or_'
Addshore lowered the priority of this task from High to Low.Aug 17 2021, 9:41 AM
Addshore moved this task from To Prioritize to Triaged Low (0-50) on the [DEPRECATED] wdwb-tech board.

This is a crash in Kartographer where it tries to make a link for the special page. Because subpages cannot start or end with an _ and because the language passed for this link does.

I looked into this a bit, but it seems to me like a Wikibase error, not a Kartographer error..

If I run this on a normal pageview, the parser->getLanguage() only returns valid languages. This must mean that the parser instantiated for the enitityviewaction chain is being instantiated without validating if it is a known language.

I was looking first at GlobeCoordinateKartographerDataUpdater:updateParserOutput Here the user language of the page is passed to kartographer it seems, sourced from jsconfigvars, without checking if it is known. Its already strange it is using jsconfigvars here, but even if it was that spot, it means that wikibase already instantiated the userlanguage incorrectly for the entire page ???

I don't have a working wikibase install now, so its a bit hard to check much deeper.

Change #1037430 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Validate target language as well before using it

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

Change #1037430 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Validate target language as well before using it

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

thiemowmde closed this task as Resolved.EditedMay 31 2024, 9:36 AM

I ended adding a bit of extra-pedantic code that validates the language before using it, see https://gerrit.wikimedia.org/r/1037430. I think this is reasonable. This class already does language validation anyway.

Alternatives are:

  • Change core and specifically ParserOptions so it doesn't forward invalid language codes. However, I'm not sure how complicated this is or if it's even possible as it might have unwanted side-effects.
  • Change LanguageFactory to fail when the input is invalid. However, this is obviously a breaking change with probably unwanted consequences.
  • Make the responsible code in Wikibase validate the language before using it. I can see at least one place in GlobeCoordinateKartographerFormatter that constructs a Language object from user input (that ValueFormatter option can actually be user-provided via the &lang= URL parameter) without any extra validation. The code apparently assumes LanguageFactory would do that, but it doesn't. The LanguageFactory documentation actually says one needs to manually validate user input before using it.
thiemowmde removed thiemowmde as the assignee of this task.

Change #1037743 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Wikibase@master] Mark code passing invalid user input to LanguageFactory with FIXME

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