Mismatched input syntax for Cite error messages
Closed, ResolvedPublic

Description

Author: happy_melon

Description:
The majority of the system messages that are used by Cite.php as error messages accept full wikimarkup; but those that are displayed in the references section (eg [[MediaWiki:Cite error refs without references]]) silently strip wikilinks. See [[Help talk:Cite errors#Problems]]


Version: unspecified
Severity: enhancement

bzimport added a project: Cite.Via ConduitNov 21 2014, 10:31 PM
bzimport set Reference to bz17865.
bzimport created this task.Via LegacyMar 8 2009, 7:42 PM
Gadget850 added a comment.Via ConduitSep 20 2009, 2:36 PM

To clarify:

These messages do not parse internal wikilinks:

  • MediaWiki:Cite error refs without references
  • MediaWiki:Cite error references no backlink label
  • MediaWiki:Cite error references no text

You can work around this by using an external link, however MediaWiki:Cite error references no text mangles the link causing the HTML to show.

Gadget850 added a comment.Via ConduitMay 23 2010, 8:50 PM

Correction:

This message does not parse wikilinks:

MediaWiki:Cite error refs without references

These messages do not parse wikilinks or external links:

MediaWiki:Cite error references no backlink label
MediaWiki:Cite error references no text

Gadget850 added a comment.Via ConduitJul 30 2010, 9:44 AM
  • Bug 24095 has been marked as a duplicate of this bug. ***
siebrand added a comment.Via ConduitSep 16 2011, 9:37 PM

Per Platonides at wikitech-1 [1]:

I don't see the problem with those messages, though. They look like the
rest of Cite errors. Just through the parser instead of the wfMsg()
calls (which would have its own problems). Seems that ParserBeforeTidy
is too late for doing a recursiveTagParse().
Just replacing the call to Cite::parse() of Cite::error with a call to
MessageCache::singleton()->parse() looks like the best solution.
We don't need to keep the parser context for errors.
And now MessageCache::parse() doesn't pollute the $wgParser state.

[1] http://lists.wikimedia.org/pipermail/wikitech-l/2011-September/055208.html

Anomie added a comment.Via ConduitNov 11 2011, 3:27 PM

MediaWiki:Cite error refs without references is the only one of these three called during ParserBeforeTidy. The specific problem seems to be that it misses the call to replaceLinkHolders(), although it would be easy to construct a message that missed the call to doBlockLevels() or some of the other operations in there. I don't know whether using MessageCache::singleton()->parse() would really be the best solution though; wouldn't that lose categories and such added by the error message? A "ParserAfterParse" hook (called just after the call to internalParse) might be better.

As for the other two, it seems to be a completely different problem. Consider what happens when MediaWiki:Cite error references no text needs to be output:

  1. Cite loads MediaWiki:Cite error references no text, via wfMsgNoTrans. Let's say that has the text "Cite error! [[help]]".
  2. Cite passes that through recursiveTagParse. The message is now something like "Cite error! <!--LINK 12:0-->".
  3. This error text gets embedded into the wikitext to be output for the <references/> tag.
  4. The wikitext to be output from the <references/> gets run through recursiveTagParse again. So the link marker gets interpreted as a comment and gets removed.

In this case, using MessageCache::singleton()->parse() would give the same sort of problem that using external links gives for those messages. The best fix would be to skip step 2 completely.

Anomie added a comment.Via ConduitNov 11 2011, 4:53 PM

Created attachment 9421
Fix double-parsed error messages

Here is a patch to fix the second of the two issues, where MediaWiki:Cite error references no backlink label and MediaWiki:Cite error references no text are double-parsed and so cannot contain wikilinks or external links.

attachment bug17865.patch ignored as obsolete

Anomie added a comment.Via ConduitNov 11 2011, 5:17 PM

Created attachment 9422
Add and use a "ParserAfterParse" hook

Here is a proof-of-concept patch to add the "ParserAfterParse" hook mentioned above, and then use it in Cite to fix the problem with MediaWiki:Cite error refs without references.

A real patch would update docs/hooks.txt too, and anything else that might be necessary. And might pick a better name than "ParserAfterParse".

Attached: bug17865.patch2

Catrope added a comment.Via ConduitNov 14 2011, 12:22 PM

(In reply to comment #6)

Created attachment 9421 [details]
Fix double-parsed error messages

Here is a patch to fix the second of the two issues, where MediaWiki:Cite error
references no backlink label and MediaWiki:Cite error references no text are
double-parsed and so cannot contain wikilinks or external links.

Modified patch applied in r102972.

attachment bug17865.patch ignored as obsolete

bzimport added a comment.Via ConduitNov 14 2011, 12:36 PM

wicke wrote:

Alternate solution using MessageCache::singleton()->parse()

Alternate solution to Roan's committed one using MessageCache::singleton()->parse() for all error messages- we were working on the same bug. Does not support categories from error messages. Might be a good or bad thing.

Attached: cite.patch

Anomie added a comment.Via ConduitNov 14 2011, 3:19 PM

(In reply to comment #9)

Alternate solution to Roan's committed one using
MessageCache::singleton()->parse() for all error messages- we were working on
the same bug. Does not support categories from error messages. Might be a good
or bad thing.

Categories in the error messages are heavily used on enwiki. There are even bots that watch these categories to try to fix the errors.

Also, did you test this with the other errors? In a quick test here, it seems to do just as I predicted in comment 5.

Gadget850 added a comment.Via ConduitNov 14 2011, 4:01 PM

Specifically, en.wiki uses [[Template:Broken ref]] to add the message and the category, based on namespace.

Also: [[MediaWiki:Cite error group refs without references]] does not support wikilinks, so it uses an external link hack.

MarkAHershberger added a comment.Via ConduitNov 16 2011, 8:23 PM

Comment on attachment 9421
Fix double-parsed error messages

Roan applied this

MarkAHershberger added a comment.Via ConduitNov 16 2011, 8:38 PM

(In reply to comment #7)

Created attachment 9422 [details]
Add and use a "ParserAfterParse" hook

A real patch would update docs/hooks.txt too, and anything else that might be
necessary. And might pick a better name than "ParserAfterParse".

I'm looking at this today. Could you supply a modification to docs/hooks.txt so that I can apply this?

Attached: bug17865.patch2

Anomie added a comment.Via ConduitNov 21 2011, 12:35 AM

Created attachment 9504
Patch to docs/hooks.txt

(In reply to comment #13)

(In reply to comment #7)
> Created attachment 9422 [details]
> Add and use a "ParserAfterParse" hook

> A real patch would update docs/hooks.txt too, and anything else that might be
> necessary. And might pick a better name than "ParserAfterParse".

I'm looking at this today. Could you supply a modification to docs/hooks.txt
so that I can apply this?

Ok.

Attached: diff

Billinghurst added a comment.Via ConduitFeb 26 2012, 3:33 AM

Mark, where is this situated?

MarkAHershberger added a comment.Via ConduitMar 1 2012, 7:18 PM

(In reply to comment #15)

Mark, where is this situated?

r102972 is Roan's revision. It is without the hook, so I guess the other part isn't needed.

Anomie added a comment.Via ConduitMar 5 2012, 3:37 PM

(In reply to comment #16)

r102972 is Roan's revision. It is without the hook, so I guess the other part
isn't needed.

r102972 is the patch in attachment 9421, which fixes the problem with MediaWiki:Cite error references no backlink label and MediaWiki:Cite error references no text.

r102972 does not fix the problem with MediaWiki:Cite error refs without references; I have not checked to see whether that problem might have been fixed by some other revision or whether it is still outstanding.

Gadget850 added a comment.Via ConduitMay 3 2012, 2:39 AM

Confirmed: The issue with all three messages is resolved.

  • MediaWiki:Cite error references no backlink label
  • MediaWiki:Cite error references no text
  • MediaWiki:Cite error refs without references
Gadget850 added a comment.Via ConduitMay 6 2012, 1:52 PM

MediaWiki:Cite error refs without references

This interface page is still not fixed. Have to use an external link as an internal wikilink does not work.

Anomie added a comment.Via ConduitMay 7 2012, 3:30 PM

(In reply to comment #19)

MediaWiki:Cite error refs without references

This interface page is still not fixed. Have to use an external link as an
internal wikilink does not work.

Reopening then.

bzimport added a comment.Via ConduitJun 15 2012, 11:16 PM

sumanah wrote:

Brad, is this patch worth putting into Gerrit?

Anomie added a comment.Via ConduitJun 17 2012, 12:47 AM

(In reply to comment #21)

Brad, is this patch worth putting into Gerrit?

Yes, it is. But since it touches core and an extension, it apparently needs to be done in two parts: Gerrit change 11736 and Gerrit change 11737.

Matanya added a comment.Via ConduitAug 12 2012, 9:37 AM

Both patches were merged.

Billinghurst added a comment.Via ConduitDec 13 2012, 12:12 PM

There is the comment at https://en.wikipedia.org/w/index.php?title=MediaWiki%3ACite_error_refs_without_references&diff=512245290&oldid=512244781 that says that it isn't fixed. I haven't further tested.

Anomie added a comment.Via ConduitDec 13 2012, 2:25 PM

Looks fixed to me. I've asked Gadget850 for details.

Qgil added a comment.Via ConduitDec 13 2012, 3:12 PM

Can you please assign the bugs you mark as ASSIGNED or FIXED? Clicking the "take" link adds just an extra second to your work, improves our workflow and avoids any chance to get pointless notifications like this one. :)

Background & discussion: http://lists.wikimedia.org/pipermail/wikitech-l/2012-December/064874.html - please follow-up there is you wish. Thank you!

Anomie added a comment.Via ConduitDec 13 2012, 3:15 PM

(In reply to comment #26)

and avoids any chance to get pointless notifications like this one. :)

Especially pointless on bugs closed 4 months ago. ;)

Gadget850 added a comment.Via ConduitDec 13 2012, 3:37 PM

(In reply to comment #25)

Looks fixed to me. I've asked Gadget850 for details.

I restored the MediaWiki page and it now works. Close as fixed.

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.