Page MenuHomePhabricator

Refactor LanguageConverter::findVariantLink() to make it less error-prone
Open, Needs TriagePublic

Description

The LanguageConverter::findVariantLink() method accepts two parameters about the link, a string for $link and an optional Title object.
The modified value of $link is from Title::getText(), which without the namespace prefix, uses spaces instead of underscores. However, there is no restriction on the input value.
The two parameters are redundant and can easily be misused (T328477), where the caller passes the DB key as the parameter and use the modified value as a DB key.
Also, it would allow undocumented use cases, e.g. with no Title object provided but with a namespace-prefixed link.

The new method to replace it should accept a PageIdentity or Title as the only parameter about the page to avoid ambiguity.

Event Timeline

@Func: Removing task assignee as this open task has been assigned for more than two years - See the email sent on 2025-05-22.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome!
If this task has been resolved in the meantime, or should not be worked on by anybody ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!