Skip to content

SLOP-377: replace removed WatchAction::getWatchToken() with getEditToken( 'watch' ) - #12

Open
tosfos wants to merge 1 commit into
masterfrom
SLOP-377-port-watchtoken
Open

SLOP-377: replace removed WatchAction::getWatchToken() with getEditToken( 'watch' )#12
tosfos wants to merge 1 commit into
masterfrom
SLOP-377-port-watchtoken

Conversation

@tosfos

@tosfos tosfos commented Aug 23, 2026

Copy link
Copy Markdown

Summary

WatchAction::getWatchToken() was removed in MediaWiki 1.38. Both call sites fatal on MW 1.38+:

  • includes/WatchAnalyticsParserFunctions.php:231 ({{#watchers_needed:}} watch links)
  • includes/WatchSuggest.php:353 (watch-suggestion links)

The removed method was a thin wrapper: return $user->getEditToken( 'watch' ); — and the salted 'watch' token is exactly what core's watch form still validates (HTMLForm::$mTokenSalt, matchEditToken( $token, 'watch' )). Both sites now call $user->getEditToken( 'watch' ) directly, producing identical URLs.

Verification

  • php -l clean on php:7.4-cli and php:8.2-cli for both files.
  • Harness (7.4 + 8.2): emitted token carries the +\ suffix and round-trips through matchEditToken( ..., 'watch' ); salt mismatch rejected, proving the salt is actually applied.
  • Repo-wide grep: zero remaining getWatchToken references.

Closes SLOP-377.

…ken(watch)

WatchAction::getWatchToken() was removed in MW 1.38; it was a thin
wrapper around $user->getEditToken( \x27watch\x27 ), which core still
validates when processing action=watch. Port both call sites.
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a7b508d2-59d4-4dc6-b2a5-6cb332617249


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant