Page MenuHomePhabricator

Spaces before [[Category:]] link are ignored
Open, LowPublicBUG REPORT


Two-character fix

Parser.php contains a strange construct (line 1703):
$s = rtrim($s . "\n");

I would guess the added newline is just a waste of time/memory, since it gets trimmed again immediately. I believe the original author (see r8309) intended to write a comma instead of a dot.

And indeed, the line should IMHO read
$s = rtrim($s, "\n");
because at the current version, spaces before category links are ignored, so that wikitext like “Lorem [[Category:Foo]]ipsum]]” ends up showing “Loremipsum”, not “Lorem ipsum” one might expect (see the attached URL).

Not that it would be any major bug ;-)

Version: 1.21.x
Severity: trivial




Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:33 PM
bzimport set Reference to bz17988.
bzimport added a subscriber: Unknown Object (MLST).

karun.84 wrote:

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

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

This caused some pages to go entirely blank... reverted in r56472.

Example self-contained test case (not totally minimized) at

Update keywords (-/- easy, reviewed, +need-review)

Remove Keyword patch, it obviously didn't work

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

Added the "reviewed" keyword since Mormegil received a review of the patch. Mormegil, do you know whether the bug is still reproducible?

(In reply to comment #9)

Mormegil, do you know whether the bug is still reproducible?

Yes, it is. The URL linked above leads to a simple reproducible testcase, showing that “Lorem [[Category:Foo]]ipsum” renders as “Loremipsum” (with the Foo category added).

sumanah wrote:

Still reproducible in master.

Same for whitespace between two links.

When table is not closed.


12345 aaaa [[WBC]] [[WBC]] bbb 12345

aravikn wrote:

Is this bug resolved?

bburette wrote:

(In reply to comment #14)

Is this bug resolved?


No the bug has not been corrected, I just tested. It is still present in current MediaWiki, version "MediaWiki 1.23wmf10". See link for an example.


aravikn wrote:

Thanks Bernard. BTW, Are the changes mentioned in comment 1 sufficient for actually fixing this?

To avoid confusion:

Steps to reproduce:
*Type the text "Lorem [[Category:Foo]]ipsum" into a wiki page (without quotes)
*Hit save.

Expected output is the two words "Lorem ipsum"

Actual output is a single word "Loremipsum"

The space between "Lorem" and the category tag seems to disappear.

Change 108205 had a related patch set uploaded by Arav93:
Put the space before category links to consideration

Aklapper changed the subtype of this task from "Task" to "Bug Report".Feb 5 2022, 2:33 PM
Aklapper removed a subscriber: wikibugs-l-list.