Page MenuHomePhabricator

Error generation of unbalanced <ref><references/>: No error is shown if missing </ref>-tag is the last ref tag
Closed, ResolvedPublic

Description

If the missing </ref>-tag is the last ref tag, no error message is displayed.
Works correct: <ref>broken <ref>correct</ref> <references />
Doesn't work : <ref>broken <references />

See also https://bugzilla.wikimedia.org/show_bug.cgi?id=6199#c25 for comments on that


Version: unspecified
Severity: minor
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=26145

Details

Reference
bz15712

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:22 PM
bzimport added a project: Cite.
bzimport set Reference to bz15712.
bzimport added a subscriber: Unknown Object (MLST).

dunc_harris wrote:

No this isn't fixed per se:

the sequence "<ref><references/>" generates the error:

"Cite error: Cite error: There are <ref> tags on this page, but the references will not show without a <references/> tag."

But this is the wrong error message because there is indeed a <references/> in the page. The error should be:

"Cite error: Closing </ref> missing for <ref> tag"

or maybe even:

"Cite error: Closing </ref> missing for last <ref> tag"

  • Bug 21798 has been marked as a duplicate of this bug. ***

(In reply to Duncan Harris from comment #2)

the sequence "<ref><references/>" generates the error:

"Cite error: Cite error: There are <ref> tags on this page, but the
references will not show without a <references/> tag."

But this is the wrong error message because there is indeed a <references/>
in the page. The error should be:

"Cite error: Closing </ref> missing for <ref> tag"

or maybe even:

"Cite error: Closing </ref> missing for last <ref> tag"

It doesn't output an error message anymore because, apparently because bug 66860 has been resolved and it now just silently eats the error message.

If the last </ref> was missing, then the reference list markup would get eaten and it would trigger 'MediaWiki:Cite error refs without references'. On enwiki, this would put the page into an error category and it would be fixed.

Bug 66860 added the automatic reference list, so 'MediaWiki:Cite error refs without references' is never triggered. Instead, the unclosed <ref> eats the following content and includes it in the last rendered reference.

Example:

<ref>1

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Bu if the reference list markup exists, then the last reference is generated twice and the the reference list markup is exposed.

Example:

<ref>1

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

<references />

There may be other instances where this renders differently.

Bumping up importance since we can no longer track and resolve this problem.

matmarex added subscribers: eranroz, Kipod, matmarex and 3 others.

Since a references block is now automatically added if there isn't one, this now causes a different (and even more interesting) effect:

<ref>Foo</ref
Bar
<references/>
pasted_file (90×284 px, 2 KB)

By the way, this seems to work in the desired way in Parsoid, see T58306 about the discrepancy.

https://gerrit.wikimedia.org/r/#/c/255258/ "Preprocessor: Don't allow unclosed extension tags (matching until end of input)" is likely to help here, if it's merged. At least for simple cases like the one I gave above it's a lot saner. Not sure if it'll help for messier ones (but it'll change things around).

matmarex claimed this task.
matmarex removed a project: Patch-For-Review.

https://gerrit.wikimedia.org/r/#/c/255258/ was merged, reverted due to issues with <noinclude>, then done again with that fixed as https://gerrit.wikimedia.org/r/#/c/268335/. I think this is resolved now.

<ref>Foo</ref
Bar
<references/>
pasted_file (34×135 px, 1 KB)

There is no error message (Cite has no way to detect this), but we don't ruin the whole page's layout and the tag is simply displayed unparsed.