Skip to content

PHP syntax highlighting does not correctly detect end of string #147037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pedroterzero opened this issue Apr 7, 2022 · 3 comments
Closed

PHP syntax highlighting does not correctly detect end of string #147037

pedroterzero opened this issue Apr 7, 2022 · 3 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@pedroterzero
Copy link

pedroterzero commented Apr 7, 2022

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

Version: 1.66.0
Commit: e18005f0f1b33c29e81d732535d8c0e47cafb0b5
Date: 2022-03-30T05:50:41.156Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Linux x64 5.13.0-39-generic snap

OS is Ubuntu 20.04

Description

When I use a string variable formatted as in the example, code after the variable is incorrectly coloured

This is what it ends up looking like for me:
Screenshot from 2022-04-07 20-48-23

I'd expect this to parse the string correctly. The output should look more like this:
Screenshot from 2022-04-07 20-50-07

Test case:

<?php

$test = 'AND [' . $foo['bar'];

// hi i am a comment
if (true) {
    print 'test';
}

Steps to Reproduce:

Create a test file, test.php with the contents from the test case

@alexr00
Copy link
Member

alexr00 commented Apr 8, 2022

@pedroterzero it looks like the PHP grammar we use assumes that strings that start with AND are sql. Is it your intent that $test is sql?

@alexr00 alexr00 added the info-needed Issue requires more information from poster label Apr 8, 2022
@pedroterzero
Copy link
Author

pedroterzero commented Apr 8, 2022

@pedroterzero it looks like the PHP grammar we use assumes that strings that start with AND are sql. Is it your intent that $test is sql?

In this particular instance it happened to be a SOLR query with a range query. It's a legacy project.

@alexr00
Copy link
Member

alexr00 commented Apr 12, 2022

Thanks! I've moved this issue to the upstream repo that we get our PHP syntax highlighting grammar from: atom/language-php#453

@alexr00 alexr00 added upstream-issue-linked This is an upstream issue that has been reported upstream and removed info-needed Issue requires more information from poster labels Apr 12, 2022
@alexr00 alexr00 closed this as completed Apr 12, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

5 participants
@alexdima @sandy081 @alexr00 @pedroterzero and others