Last modified: 2012-12-13 15:37:54 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T19865, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 17865 - Mismatched input syntax for Cite error messages
Mismatched input syntax for Cite error messages
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Cite (Other open bugs)
unspecified
All All
: Low enhancement with 2 votes (vote)
: ---
Assigned To: Brad Jorsch
: patch, patch-need-review
: 24095 (view as bug list)
Depends on:
Blocks: 18521
  Show dependency treegraph
 
Reported: 2009-03-08 19:42 UTC by Happy-melon
Modified: 2012-12-13 15:37 UTC (History)
12 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Fix double-parsed error messages (3.14 KB, patch)
2011-11-11 16:53 UTC, Brad Jorsch
Details
Add and use a "ParserAfterParse" hook (2.13 KB, patch)
2011-11-11 17:17 UTC, Brad Jorsch
Details
Alternate solution using MessageCache::singleton()->parse() (1.07 KB, patch)
2011-11-14 12:36 UTC, Gabriel Wicke
Details
Patch to docs/hooks.txt (604 bytes, patch)
2011-11-21 00:35 UTC, Brad Jorsch
Details

Description Happy-melon 2009-03-08 19:42:37 UTC
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]]
Comment 1 Gadget850 2009-09-20 14:36:41 UTC
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.

Comment 2 Gadget850 2010-05-23 20:50:53 UTC
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
Comment 3 Gadget850 2010-07-30 09:44:59 UTC
*** Bug 24095 has been marked as a duplicate of this bug. ***
Comment 4 Siebrand Mazeland 2011-09-16 21:37:32 UTC
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
Comment 5 Brad Jorsch 2011-11-11 15:27:26 UTC
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.
Comment 6 Brad Jorsch 2011-11-11 16:53:43 UTC
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.
Comment 7 Brad Jorsch 2011-11-11 17:17:21 UTC
Created attachment 9422 [details]
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".
Comment 8 Roan Kattouw 2011-11-14 12:22:20 UTC
(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.
Comment 9 Gabriel Wicke 2011-11-14 12:36:22 UTC
Created attachment 9443 [details]
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.
Comment 10 Brad Jorsch 2011-11-14 15:19:09 UTC
(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.
Comment 11 Gadget850 2011-11-14 16:01:29 UTC
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.
Comment 12 Mark A. Hershberger 2011-11-16 20:23:42 UTC
Comment on attachment 9421 [details]
Fix double-parsed error messages

Roan applied this
Comment 13 Mark A. Hershberger 2011-11-16 20:38:28 UTC
(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?
Comment 14 Brad Jorsch 2011-11-21 00:35:04 UTC
Created attachment 9504 [details]
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.
Comment 15 billinghurst 2012-02-26 03:33:01 UTC
Mark, where is this situated?
Comment 16 Mark A. Hershberger 2012-03-01 19:18:23 UTC
(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.
Comment 17 Brad Jorsch 2012-03-05 15:37:40 UTC
(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 [details], 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.
Comment 18 Gadget850 2012-05-03 02:39:12 UTC
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
Comment 19 Gadget850 2012-05-06 13:52:33 UTC
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.
Comment 20 Brad Jorsch 2012-05-07 15:30:58 UTC
(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.
Comment 21 Sumana Harihareswara 2012-06-15 23:16:44 UTC
Brad, is this patch worth putting into Gerrit?
Comment 22 Brad Jorsch 2012-06-17 00:47:34 UTC
(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.
Comment 23 matanya 2012-08-12 09:37:02 UTC
Both patches were merged.
Comment 24 billinghurst 2012-12-13 12:12:40 UTC
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.
Comment 25 Brad Jorsch 2012-12-13 14:25:17 UTC
Looks fixed to me. I've asked Gadget850 for details.
Comment 26 Quim Gil 2012-12-13 15:12:53 UTC
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!
Comment 27 Brad Jorsch 2012-12-13 15:15:38 UTC
(In reply to comment #26)
> and avoids any chance to get pointless notifications like this one.  :)

Especially pointless on bugs closed 4 months ago. ;)
Comment 28 Gadget850 2012-12-13 15:37:54 UTC
(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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links