Skip to content

(PHP) mishandling apostrophes in single line comments in multiline function calls/definitions. #4297

@g-regor

Description

@g-regor

When the function arguments are written across multiple lines, comments with apostrophes on those lines, break highlighting and consider everything after the single quote as a comment, until the next single quote.

On the highlight.js's demo website (version 11.11.1):

Image

Example (with GitHub's correct highlightning):

<?php
	func(
		1, // comment's apostrophe
		2
	);
	function func(
		$a, // comment's apostrophe
		$b,
	) {};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions