Skip to content

[bug] PHP: class_start regex misses anonymous classes #2216

Closed

Description

@squid-protocol

During a sweep of the tri-comparison ledger, we found that the PHP class_start regex completely misses anonymous classes.

Example from laravel_core/BladeCompiler.php:

$component = new class($string) extends Component
{

Ctags correctly extracts this, but GitGalaxy drops it. We should evaluate whether anonymous classes should be supported by the regex or if they intentionally belong in a different grammatical bucket.

Activity

  1. added
    bug
    core-engine
    threat: false-negative
    on Aug 24, 2026
  2. squid-protocol commented on Aug 26, 2026

    @squid-protocol
    OwnerAuthor

    Closing — this was filed against a since-corrected ledger verdict, and the "GitGalaxy drops a real anonymous class" framing has it backwards.

    The example (laravel_core/BladeCompiler.php, new class($string) extends Component { ... }) is the exact construct behind php/class/existence/agree[ctags]_vs[gitgalaxy,tree_sitter]. That ledger entry originally read "GitGalaxy misses anonymous classes" (the premise this issue inherited), but was corrected on 2026-08-24 (commit dd496a5) after review: ctags fabricates a synthetic placeholder name (AnonymousClass206420800100) for the construct — there is no real name in the source to extract. GitGalaxy and tree-sitter are both correct to not report a name that doesn't exist; ctags is the one over-extracting here, not the other way around.

    No action needed on the engine side. Current, validated verdict is on the ledger entry above if this needs to be revisited later.

  3. added 2 commits that reference this issue on Aug 26, 2026
    2382b89
    d45eedd
  4. added this to the v2.4.9 milestone on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginethreat: false-negative

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions