Skip to content

rules: a condition that does not evaluate to a boolean throws a TypeError #370

Closed

Description

@njoubert-cleverage

RulesTransformer::matchRule() is declared bool but returns the raw result of the expression (RulesTransformer.php, return $this->language->evaluate(...)).

An expression that does not evaluate to a boolean throws a TypeError: preg_match(...) (exposed by the documentation, it returns an int), the matches operator, or a single variable used as condition.

The defect exists since v4.0.0.

Fix: cast the result to bool.

Found during the audit v3 (audit-v3-angles.md #192).

Activity

  1. added a commit that references this issue on Oct 23, 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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions