Page MenuHomePhabricator

Inconsistent table recognition
Open, LowPublic

Description

Author: Jared.Williams1

Description:
Browsing more Parser.php https://static-codereview.wikimedia.org/MediaWiki/28588.html code and found this inconsistency.

Parser::doTableStuff() ( Parser.php:740 ) trim()s the line before attempting to match table tokens. Thereby allowing a table token to appear after whitespace or NUL characters.

Eg:

{|

T2529 resolution in Parser::braceSubstitution() ( Parser.php:3354 ) doesn't take into account possible whitespace or NUL characters.

if (!$piece['lineStart'] && preg_match('/^(?:{\\||:|;|#|\*)/', $text)) /*}*/{
	$text = "\n" . $text;
}

Version: 1.21.x
Severity: minor

Details

Reference
bz12339

Event Timeline

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

Current code says:
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/parser/Parser.php;h=8671665ffc8cec343f8852dbdfa4e238a8591011;hb=HEAD#l3462

3463 && !$piece['lineStart']
3464 && preg_match( '/^(?:{\\||:|;|#|\*)/', $text ) )

so I guess this is still valid...