Skip to content

PHP: hash in SQL string breaks syntax highlighting #48096

Closed

Description

  • VSCode Version: 1.22.2
  • OS Version: Ubuntu 16.04.4 LTS

Steps to Reproduce:

This code:

<?php
$sql = 'SELECT \' #\' || fieldid FROM sometable';

Highlights like so:

image

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

Activity

  1. vscodebot commented on Apr 18, 2018

    @vscodebot

    (Experimental duplicate detection)
    Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

  2. added
    php
    on Apr 18, 2018
  3. neerolyte commented on Apr 18, 2018

    @neerolyte
    Author

    PHP Syntax broken by PHP->CSS->PHP embedding (#38275)

    This is a different syntax problem.

  4. roblourens commented on Apr 18, 2018

    @roblourens
    Member
  5. added
    upstream
    on Apr 18, 2018
  6. sergiolch commented on Jul 16, 2019

    @sergiolch

    I also have a similar issue with SQL:

    class test2 {
        public function method1($txt)
        {
            $q = "SELECT b2.*
                FROM
                (SELECT users
                ORDER BY id DESC) as b2";
            return $this->query($q);
        }
        public function method2()
        {
            return true;
        }
    }

    but it looks like this:

    Screen Shot 2019-07-16 at 3 33 53 PM

  7. MikeTodd commented on Sep 12, 2019

    @MikeTodd

    I noticed a similar bug: #80810

    Note that this only happens when SELECT is in all caps, and you're using a single-quote within the string.

  8. added this to the Backlog milestone on Oct 27, 2019
  9. misterHippo commented on Nov 8, 2019

    @misterHippo

    I have a similar issue while checking for SQL injection segments.

    "SELECT /*!" is in an array, and the syntax highlighting is all green (comments) after it, even though it's within quotes. If I make it a lower case select, then it fixes itself

    Alternatively, if I put /* ? */ after it, everything changes to that burnt orange colour (string?)

    Interestingly, "SELECT USER()", "SELECT SUBSTRING(user_password", "' or 1=1/*" and ["/*! MYSQL Special SQL *" don't bring about the same outcome.

  10. Blurazzle commented on Nov 21, 2019

    @Blurazzle

    I have a similar problem. This database has column names with a #. These columns break the syntax highlighting.
    image

  11. DABugh commented on Oct 27, 2020

    @DABugh

    Similar (PHP):

    image

    This only happens for me when the string begins with syntax which is interpreted as being part of an SQL query (e.g. "AND"), there is a variable concatenated between two double-quoted strings each containing one single-quote, and the variable outside of the string has two levels of encapsulation.

    In the screenshot, "->value" is the wrong color, as are the two concatenation periods on either side of the variable expression.

  12. added
    confirmed
    on Nov 6, 2020
  13. roblourens commented on Dec 13, 2022

    @roblourens
    Member

    Since the upstream project has been archived, merging this into the general issue for a new SSH grammar. #162707

  14. locked and limited conversation to collaborators on Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmedphpupstream

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions