-
Notifications
You must be signed in to change notification settings - Fork 120
problem with ( in qoutes #442
Comments
After this code the rest of the code is not formatted in correct colours: $sql = $sql . " AND ($key LIKE '" . $valuex . "'"; |
This is known issue and rather hard to fix. Try to avoid incomplete sql syntax, for example: $value = ['testA', 'testB'];
if(isset($value) AND count($value)){
$search = array_map(fn($valuex) => "{$key} LIKE '%{$valuex}%'", $value);
$search = implode(' OR ', $search);
} else {
$search = "{$key} = '0'";
}
$sql .= " AND ({$search})"; Even better would be to use prepared statements to prevent some attacks using insecure variables https://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php |
This is an issue even if the query itself is unbroken. See this example, where everything after the $query variable loses the syntax highlighting
Taking the last parentheses and making it it's own string gets the syntax highlighting back
|
@echantigny I'm unable to reproduce your issue. Can you provide screenshot showing the problem? Which version of atom are you using? Which version of language-php? That's how your code looks like on my end (don't mind whitespace symbols): |
@KapitanOczywisty I just realised that the github issue I was looking at for VSCode sent me here, on the Atom project. If it really is linked projects, this is what I have installed with PHP Intelephense. Otherwise, well... you can ignore my messages. :) Version: 1.63.2 (user setup) And as of this morning (VS Code updated last night), it looks like this is fixed now. Sorry! |
@echantigny This is the right place, VS Code is using syntax from this repository and Intelephense doesn't provide syntax highlighting. Last update was a month ago, so there might be something wrong if VS Code updated yesterday. I've also tested your code in VS Code yesterday and it was fine. Let me know if something similar happens again. |
Prerequisites
Description
Steps to Reproduce
Expected behavior:
Actual behavior:
Reproduces how often:
Versions
Additional Information
The text was updated successfully, but these errors were encountered: