Skip to content
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

(php) Semicolon inside string parsed as end of statement #4006

Open
pkaminski opened this issue Mar 1, 2024 · 3 comments · May be fixed by #4130
Open

(php) Semicolon inside string parsed as end of statement #4006

pkaminski opened this issue Mar 1, 2024 · 3 comments · May be fixed by #4130
Labels
bug help welcome Could use help from community language

Comments

@pkaminski
Copy link
Contributor

Describe the issue
It looks like a semicolon inside a string is parsed as terminating the statement, at least sometimes.

Which language seems to have the issue?
php

Are you using highlight or highlightAuto?
highlight

Sample Code to Reproduce
Fiddle here: https://jsfiddle.net/c3sLm2ga/. See how the highlighting gets messed up halfway through the string in the throw statement. Oddly, double-quoted strings are also affected but in a slightly different way.

Expected behavior

public static function mutate() {
  $result = null;
  DB::transaction(function () use (): void {
    if (static::$currentMutator !== null) {
      throw new LoggingMutatorException('LoggingMutator::mutate called while already in a mutation; nested mutations are not supported.');
    }
    $operationLogger = new OperationLogger($user);
  })
}
@pkaminski pkaminski added bug help welcome Could use help from community language labels Mar 1, 2024
@joshgoebel
Copy link
Member

Nothing to do with strings, this is broken from use because we're expecting that has special meaning and must be terminated by a ;:

Screen Shot 2024-03-01 at 6 05 45 PM

@pkaminski
Copy link
Contributor Author

Interesting — is the PHP code's syntax incorrect then? (I know nothing about PHP, this was reported by a user.)

@pkaminski
Copy link
Contributor Author

Oh, I see — the use token is dual-use (hah!) in PHP, and HighlightJS is assuming the import/aliasing meaning, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help welcome Could use help from community language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants