Page MenuHomePhabricator

Parsing links in edit summaries behaves different from regular parser when missing square brackets
Closed, ResolvedPublic

Description

See the diff: due to a bug in AWB, edit summary was with mismatching square brackets:

no 'of' between a month and a year per [[Wikipedia:Manual_of_Style_%28dates_and_numbers%29#Longer_periods|MOS]], added [[:Category:Uncategorized stubs|uncategori using [[Project:AutoWikiBrowser|AWB]]

it resulted in the following edit summary displayed: "no 'of' between a month and a year per MOS, added AWB", where AWB is linked to [[Category:Uncategorised stubs]]. This is completely diferent from how page text parser would handle such input.

Although we're working to fix edit summary trimming code in AWB, MediaWiki should also process summaries correctly.

Details

Reference
bz15745

Event Timeline

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

Note that the parser test suite now supports testing the edit-comment mini-parser as well. Add test cases with 'comment' option.

Fixed in r53534 with parser test.

The patch https://phabricator.wikimedia.org/rSVN53534 was only reverted because it caused crashes in PHP 5.2.6. We no longer support this version, so it might be possible to simply re-apply that patch. The code in question hasn't changed much since 2009.

In T17745#1836602, @TTO wrote:

The patch https://phabricator.wikimedia.org/rSVN53534 was only reverted because it caused crashes in PHP 5.2.6. We no longer support this version, so it might be possible to simply re-apply that patch. The code in question hasn't changed much since 2009.

Seems worth trying for starters :)

In T17745#1836602, @TTO wrote:

The patch https://phabricator.wikimedia.org/rSVN53534 was only reverted because it caused crashes in PHP 5.2.6. We no longer support this version, so it might be possible to simply re-apply that patch. The code in question hasn't changed much since 2009.

Looks like the Linker code has been refactored a bit... Mostly removing the seperate callback function and bringing it into a closure...

https://github.com/wikimedia/mediawiki/blob/master/includes/Linker.php#L1391-L1494

Krinkle renamed this task from Edit summary link parsing too simplistic to Parsing links in edit summaries behaves different from regular parser when missing square brackets.Feb 9 2019, 8:29 PM
Krinkle edited projects, added MediaWiki-Parser; removed MediaWiki-Comment-store.
Krinkle claimed this task.
Krinkle subscribed.

Current rendering for the edit summary of the originally reported diff, is now better than it used to be:

Screen Shot 2019-02-09 at 20.30.30.png (136×1 px, 36 KB)

It now no longer ignores the middle chunk between the two pipes, which makes it more obvious that an error has occurred.

Having said that, it is still different from the regular wikitext parser, which as of today, renders as follows:

Screen Shot 2019-02-09 at 20.31.49.png (466×1 px, 120 KB)

Given this is only about behaviour in case of invalid syntax, I think we can close this. They were never meant to behave the same for invalid syntax. They do, however, now behave the same for valid syntax, which might be good enough?