Sublime Forum

PHP/Regexp parsing bug

#1

Let’s say I have a line like this:

$regexp = '/\\\]/';

It’s a PHP single quoted string so, the first \ should escape the second and the third is literal so it should yield regexp like:

/\\]/

In which the first \ is (regexp) escaping the second.

But that’s not what happens. SublimeText parses this incorrectly such that it appears that the string never closes. A real life example is here:
github.com/joomla/joomla-cms/bl … e.php#L277

0 Likes