Page MenuHomePhabricator

Special:WatchlistLabels: "Call to a member function getName() on null" trying to edit a watchlist label that is not your own
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

Trying to access or submit Special:WatchlistLabels/edit&wll_id=<id> for a watchlist label <id> that is for another user, you get an exception:

[f7549075a6567b73f97af80f] /w/index.php?title=Special:WatchlistLabels/edit&wll_id=4 Error: Call to a member function getName() on null

Backtrace:

from /var/www/html/w/includes/Specials/SpecialWatchlistLabels.php(81)
#0 /var/www/html/w/includes/Specials/SpecialWatchlistLabels.php(58): MediaWiki\Specials\SpecialWatchlistLabels->showForm()
#1 /var/www/html/w/includes/SpecialPage/SpecialPage.php(711): MediaWiki\Specials\SpecialWatchlistLabels->execute()
#2 /var/www/html/w/includes/SpecialPage/SpecialPageFactory.php(1743): MediaWiki\SpecialPage\SpecialPage->run()
#3 /var/www/html/w/includes/Actions/ActionEntryPoint.php(499): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#4 /var/www/html/w/includes/Actions/ActionEntryPoint.php(143): MediaWiki\Actions\ActionEntryPoint->performRequest()
#5 /var/www/html/w/includes/MediaWikiEntryPoint.php(184): MediaWiki\Actions\ActionEntryPoint->execute()
#6 /var/www/html/w/index.php(44): MediaWiki\MediaWikiEntryPoint->run()
#7 {main}
Steps to reproduce problem
  1. On any local test environment, add this to LocalSettings.php: $wgEnableWatchlistLabels = true;
  2. Login as one user and create a watchlist label (i.e. go to Special:WatchlistLabels/edit)
  3. Go to Special:WatchlistLabels, hover over the edit icon for the label you just created and copy the URL
  4. Login as another user, and go to the URL you copied in step 3

Expected behaviour: Given some message saying you don't have access.
Observed behaviour: Above exception.

Environment

Wiki(s): local docker MediaWiki 1.46.0-alpha (661d9f0) 07:37, 18 November 2025.

Event Timeline

Would this be an appropriate error message in this case?

Label not found. The label with ID $1 does not exist, or do you do not have permission to edit it.

Actually, should it just ignore the supplied ID? That's what happens if you don't give it an integer ID, e.g. opening Special:WatchlistLabels/edit?wll_id=foo presents the 'new label' form.

I think that might be simpler.

Change #1206839 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Special:WatchlistLabels: Only set form data if label is found

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

Change #1206839 merged by jenkins-bot:

[mediawiki/core@master] Special:WatchlistLabels: Only set form data if label is found

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

I can no longer reproduce this exception. If I go to Special:WatchlistLabels/edit&wll_id=<id> for a label ID that is not my own, when I submit it will create a new label.