Page MenuHomePhabricator

Syntaxhighlighting in Gerrit is broken on php here doc syntax
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

	/** Shared with GlobalWithDBTest */
	public const BAD_FILE_LIST = <<<WIKITEXT
Comment line, no effect [[File:Good.jpg]]
 * Indented list is also a comment [[File:Good.jpg]]
* [[File:Bad.jpg]] except [[Nasty page]]
*[[Image:Bad2.jpg]] also works
* So does [[Bad3.jpg]]
* [[User:Bad4.jpg]] works although it is silly
* [[File:Redirect to good.jpg]] doesn't do anything if RepoGroup is working, because we only look at
  the final name, but will work if RepoGroup returns null
* List line with no link
* [[Malformed title<>]] doesn't break anything, the line is ignored [[File:Good.jpg]]
* [[File:Bad5.jpg]] before [[malformed title<>]] doesn't ignore the line
WIKITEXT;

the highlighting looks broken, because the text contains an uneven count of ' and that makes all the highlighting in later source code swapped (code is blue, strings are black, but normally that is the other way round.
[It seems even phabricator is effected from this issue, because the whole here doc should be one color]

What should have happened instead?:
Correct syntax like in edit mode

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
Gerrit 3.3.5

Event Timeline

I *think* this may be fixed from gerrit 3.6. In gerrit 3.6 we redesigned how we did syntax highlighting. Still using highlight.js but syntax highlighting should be more reliable.