Page MenuHomePhabricator

incorrectly typed redirect(s) and Special:Whatlinkshere
Closed, ResolvedPublic

Description

Author: gangleri

Description:
Halló!

a) generate [[foo REDIRECT]] with some content
b) generate [[bar REDIRECT]] withe the following content

#REDIRECT [[foo REDIRECT]
one closing braket only; this generates a functional redirect see
http://jadesukka.homelinux.org:8180/mediawiki15c/index.php?title=Bar_REDIRECT&redirect=no

But it will NOT show up in
http://jadesukka.homelinux.org:8180/mediawiki15c/index.php?title=Toiminnot:Whatlinkshere&target=Foo_REDIRECT

Regards Reinhardt


Version: 1.5.x
Severity: normal
URL: http://jadesukka.homelinux.org:8180/mediawiki15c/index.php?title=Toiminnot:Whatlinkshere&target=Foo_REDIRECT

Details

Reference
bz2084

Revisions and Commits

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:27 PM
bzimport set Reference to bz2084.
bzimport added a subscriber: Unknown Object (MLST).

avarab wrote:

Fixed in REL1_4 and HEAd, it was an invalid regular expression in
includes/Title.php that accepted redirects with the syntax #REDIRECT [[foo], the
old regular expression was \\[\\[([^\\]\\|]+)[\\]\\|] and the new one is
\[{2}(.*?)(?:\||\]{2})

rowan.collins wrote:

(In reply to comment #1)

\[{2}(.*?)(?:\||\]{2})

Won't that match unclosed piped links like "#redirect [[foo|" and "#redirect
[[foo|bar"?
I think what you want is:
\[{2}(.*?)(?:\|.*?)?\]{2}
(with a non-capturing group to eat the optional "|bar" but a compulsory "]]" at
the end)

rowan.collins wrote:

(In reply to comment #2)

\[{2}(.*?)(?:\||\]{2})

Won't that match unclosed piped links like "#redirect [[foo|" and "#redirect
[[foo|bar"?

Confirmed: see http://en.wikipedia.org/w/index.php?title=User:IMSoP/sandbox,
which contains "#REDIRECT [[User:IMSoP/Gangleri|Foo" (and
http://en.wikipedia.org/wiki/Special:Whatlinkshere/User:IMSoP/Gangleri which
fails to list this non-link, as you'd expect).

This bug is most definitely not fixed, ladies and gentlemen. I've long thought
redirect detection should be integrated into Parser.php somehow, where it could
just use the existing logic for discovering a link; at least then it would be
*consistent* (and cf bug 2333).

nicdumz wrote:

regex fix

Bug was still alive. (see http://fr.wikipedia.org/w/index.php?title=Utilisateur:NicDumZ/Test_2&redirect=no)

Included IMSoP's patch which is appropriate.

attachment 2084.diff ignored as obsolete

nicdumz wrote:

regex fix (typo)

Fixing a typo in the proposed patch.

Attached:

epriestley added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:25 AM