Page MenuHomePhabricator

Special:EditWatchlist/raw gives Exception encountered, of type "Wikimedia\Assert\ParameterTypeException"
Closed, ResolvedPublic

Description

At certain wikis, I get this error message when trying to access [[Special:EditWatchlist/raw]]
Exception encountered, of type "Wikimedia\Assert\ParameterTypeException"
E.g.
https://commons.wikimedia.org/wiki/Special:EditWatchlist/raw
https://www.mediawiki.org/wiki/Special:EditWatchlist/raw
https://meta.wikimedia.org/wiki/Special:EditWatchlist/raw
https://pt.wikibooks.org/wiki/Special:EditWatchlist/raw

It seems to be restricted to 1.27.0-wmf.18 for wikis that use Flow, and it is dependent on the account having a Flow topic on their watchlist.
I.e. as of today it does not affect
https://en.wikipedia.org/wiki/Special:EditWatchlist/raw
https://en.wikiquote.org/wiki/Special:EditWatchlist/raw (Flow not used here)
https://fr.wikibooks.org/wiki/Special:EditWatchlist/raw (Flow not used here)
and does not affect a vanilla test account at Commons until I watchlist a topic, e.g. https://commons.wikimedia.org/wiki/Topic:Smtrcre7hhh81d4z

Event Timeline

Quiddity reopened this task as Open.
Quiddity claimed this task.
Quiddity removed Quiddity as the assignee of this task.
Quiddity triaged this task as High priority.

Full error message and stack trace:

2016-03-23 20:53:39 mw1078 commonswiki 1.27.0-wmf.18 exception ERROR: [d40280c3] /wiki/Special:EditWatchlist/raw   Wikimedia\Assert\ParameterTypeException from line 89 of /srv/mediawiki/php-1.27.0-wmf.18/vendor/wikimedia/assert/src/Assert.php: Bad value for parameter $namespace: must be a integer {"exception_id":"d40280c3"} 
[Exception Wikimedia\Assert\ParameterTypeException] (/srv/mediawiki/php-1.27.0-wmf.18/vendor/wikimedia/assert/src/Assert.php:89) Bad value for parameter $namespace: must be a integer
  #0 /srv/mediawiki/php-1.27.0-wmf.18/includes/title/TitleValue.php(71): Wikimedia\Assert\Assert::parameterType(string, string, string)
  #1 /srv/mediawiki/php-1.27.0-wmf.18/includes/specials/SpecialEditWatchlist.php(424): TitleValue->__construct(string, string)
  #2 /srv/mediawiki/php-1.27.0-wmf.18/includes/specials/SpecialEditWatchlist.php(344): SpecialEditWatchlist->cleanupWatchlist()
  #3 /srv/mediawiki/php-1.27.0-wmf.18/includes/specials/SpecialEditWatchlist.php(654): SpecialEditWatchlist->getWatchlist()
  #4 /srv/mediawiki/php-1.27.0-wmf.18/includes/specials/SpecialEditWatchlist.php(93): SpecialEditWatchlist->getRawForm()
  #5 /srv/mediawiki/php-1.27.0-wmf.18/includes/specialpage/SpecialPage.php(407): SpecialEditWatchlist->execute(integer)
  #6 /srv/mediawiki/php-1.27.0-wmf.18/includes/specialpage/SpecialPageFactory.php(565): SpecialPage->run(string)
  #7 /srv/mediawiki/php-1.27.0-wmf.18/includes/MediaWiki.php(282): SpecialPageFactory::executePath(Title, RequestContext)
  #8 /srv/mediawiki/php-1.27.0-wmf.18/includes/MediaWiki.php(738): MediaWiki->performRequest()
  #9 /srv/mediawiki/php-1.27.0-wmf.18/includes/MediaWiki.php(519): MediaWiki->main()
  #10 /srv/mediawiki/php-1.27.0-wmf.18/index.php(43): MediaWiki->run()
  #11 /srv/mediawiki/w/index.php(3): include(string)
  #12 {main}
This comment was removed by Addshore.

Change 279228 had a related patch set uploaded (by Addshore):
cast namespaceId to int in SpecialEditWatchlist::cleanupWatchlist

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

9:26 PM <addshore> Either $watchedItem->getLinkTarget()->getNamespace() returns a non int on line 319 in SpecialEditWatchlist
9:26 PM <addshore> Or from the use of namespace from the db on line 363
9:26 PM <addshore> probably the second one

Might be worth casting all the stringyness to ints.
TBH it would be worth doing this throughout core....

Change 279228 merged by jenkins-bot:
Cast namespaceId to int in SpecialEditWatchlist::cleanupWatchlist

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

Change 279264 had a related patch set uploaded (by Catrope):
Cast namespaceId to int in SpecialEditWatchlist::cleanupWatchlist

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

Change 279264 merged by jenkins-bot:
Cast namespaceId to int in SpecialEditWatchlist::cleanupWatchlist

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

Change 279264 merged by jenkins-bot:
Cast namespaceId to int in SpecialEditWatchlist::cleanupWatchlist

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

Deployed now.

When reviewing all constructions of TitleValue in recently added code I also came accross this one
https://gerrit.wikimedia.org/r/#/c/279334/
Which may has resulted in a similar situation.

I guess this is why special page tests etc would be nice..

Checked Special:EditWatchlist/raw on all listed wikis - seem to be ok. Also, added a Flow topic to my watchlist in commons.wikimedia.org to see if the raw watchlist is broken - no errors displayed.