Page MenuHomePhabricator

Title::getLinksTo() appears to be broken
Open, Needs TriagePublicBUG REPORT

Description

It's hard to imagine, but it seems like change 3b6345ca1611, from June 2021, broke the method Title::getLinksTo(), and by extension the method Title::getTemplateLinksTo(), which calls getLinksTo(). Title::getLinksTo() formerly called self::getSelectFields() in order to set the SELECT fields for the DB query that it runs; this change replaced that call with LinkCache::getSelectFields(). Title::getSelectFields() returns the strings "page_namespace" and "page_title" within its array, while LinkCache::getSelectFields() does not. And Title::getLinksTo() makes use of "page_namespace" and "page_title" when processing the query results, so those missing fields are a problem.

Looking through the code, it looks like this method is barely called (which is probably why no one noticed the problem), with one exception: when "action=info" (i.e. the InfoAction class) is used on a template page, and when $wgMiserMode is set to false. I can't reproduce the problem on any Wikimedia sites (maybe $wgMiserMode is always turned on for them?), but I could reproduce it on this wiki, which runs MW 1.37, for example:

https://en.altlinux.org/Template:ISO?action=info

Event Timeline

Correction: it looks like the patch wasn't merged in until September, which makes this bug more plausible.