Author: Amalthea.wikimedia
Description:
Currently, anchor ids are created four different ways at the five different places they are used. As a test case, try "_ +.3A%3A]]"
TOC (Parser.php): "__.2B.3A.253A.5D.5D"
Link (Title.php): "_.3A:.5D.5D"
redirectToFragment (Article.php): "_.3A:.5D.5D"
History (Linker.php): "_.2B.3A.253A"
Anchorencode (CoreParserFunctions.php): "__.2B:.253A.5D.5D"
See [[User:Amalthea/test10]] for a demonstration
This regularly breaks the link from history/contributions/RC to the section, makes it hard or impossible to duplicate the functionality in tools (NAVPOP just now), and can break normal section links.
I presume this could easily be fixed by all using the same static function from Title::escapeFragmentForURL, without any additional superfluous logic (in particular stripping "[[", "[[:", "]]" in Linker.php).
The only thing that will still be necessary is ensuring unique ids in the TOC of course. This can still make those links point to unintended sections, but in a controlled way.
See also Bug 17857 and Bug 2831.
Version: unspecified
Severity: normal