function RulesReactionRule::evaluate

Reaction rules can't add variables to the parent scope, so clone $state.

File

includes/rules.plugins.inc, line 458

Class

RulesReactionRule
Represents rules getting triggered by events.

Code

public function evaluate(RulesState $state) {
    // Implement recursion prevention for reaction rules.
    if ($state->isBlocked($this)) {
        return rules_log('Not evaluating @plugin %label to prevent recursion.', array(
            '%label' => $this->label(),
            '@plugin' => $this->plugin(),
        ), RulesLog::INFO, $this);
    }
    $state->block($this);
    $copy = clone $state;
    parent::evaluate($copy);
    $state->unblock($this);
}