Page MenuHomePhabricator

frame:preprocess() now removes trailing space
Closed, ResolvedPublicBUG REPORT

Description

Steps to reproduce

  1. Open https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2022/Results.
  2. Look at the Tickets column.

Actual result

  1. The column is very wide, because there are no spaces after the commas in the tasks list.

Expected result

  1. There are spaces after the commas.

Investigation results

  1. This page uses Template:Int with the parameter comma-separator, which in turn uses Module:Int.
  2. Module:Int loads the named MediaWiki message. Its content is , , i.e. an ASCII comma followed by an ASCII space.
  3. Then it passes the loaded message to frame:preprocess.
  4. rELUA includes/Engines/LuaCommon/LuaEngine.php normalizes the line endings. Before 91232499 (@thiemowmde), it was done with str_replace( [ "\r\n", "\r" ], "\n", $input ), now it calls TextContent::normalizeLineEndings.
  5. TextContent::normalizeLineEndings does almost the same as the previous code, with the only difference being that it does an rtrim() on its input before feeding it to str_replace(). And this is where trailing space gets lost.

I suggest to revert this part of 91232499. There may be on-wiki workarounds, but since it was just a refactoring commit, with no indications for fixing any bugs, the easiest is to just revert the regression.

Event Timeline

Change 856024 had a related patch set uploaded (by Legoktm; author: Legoktm):

[mediawiki/extensions/Scribunto@master] Partially revert 912324993f, restore old line ending behavior

https://gerrit.wikimedia.org/r/856024

Change 856024 merged by jenkins-bot:

[mediawiki/extensions/Scribunto@master] Partially revert 912324993f, restore old line ending behavior

https://gerrit.wikimedia.org/r/856024

I'm going to let this roll out with the train, unless @Tacsipacsi you think it should be backported sooner (Monday probably).

Thanks for fixing it! Since it has been broken since early October, I don’t think the few extra days matter, so it’s okay for me if it rides the train.