microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.15k stars 28.53k forks source link

Wrong syntax coloring in PHP with string 'AND [' #221571

Open Daijobou opened 1 month ago

Daijobou commented 1 month ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. I use insider build fresh installed, no changes
  2. Use this code
<?php

$value = ' ANDRE [' . $test . ']';

echo 'abc';
$value = ' AND [' . $test;
$value = ' AND [' . $test . ']';
$value = ' AND [' . $test[1] . ']';

$value = ' ANDRE [' . $test . ']';

Shows in VSCode Inside and v1.91.1 this: image

php sandbox image

In vscode is a issue with string "AND ["?

EDIT: For clarification; Its "AND" with "[" in a string. This also applies to something like this: " AND abc [ abc" but this line shows correct coloring, if something comes before "AND" "abc AND abc [ abc"

Daijobou commented 1 month ago

Here are more strange things with "AND" in a string. Like this code:

<?php
$value = 'hello world!';
$value = ' AND Field=123';
$value = ' AND a.Field=123';

In vcscode Insider image

With Dark Theme "Kimbie Dark" third line is different too: image

and php sandbox, a string is a string, no extra coloring. image

alexr00 commented 1 month ago

Looks like an issue with embedded SQL in php strings.