Skip to content

Fix @filter behavior in phpgrep rules #1200

@quasilyte

Description

@quasilyte

dynamic rules @filter should work like phpgrep CLI filters.

What should be changed:

  1. There should be no restrictions on the variable expression. ${"x:const"} should work as well as $x; the :const part specifies the node class
  2. When matching, $x with a filter should not be limited to variables; $x matches anything in phpgrep. Instead of matching by variable name after a type assertion, a text slice should be taken using the $x node position info (it has begin+end positions). We usually have the current file source available during the analysis as []byte.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions