));
}
- foreach($rules as $rule) {
- try {
- $serializedParsedExpression = new ExpressionLanguage\SerializedParsedExpression(
- $rule['expression'],
- $rule['serialized']
- );
-
- $found = (bool) $expressionLanguage->evaluate($serializedParsedExpression, $vars);
- } catch (Exception $e) {
- $found = false;
- }
-
- if ($found) {
- $hook_data['filter_reasons'][] = L10n::t('Filtered by rule: %s', $rule['name']);
- break;
+ if ($rules) {
+ foreach($rules as $rule) {
+ try {
+ $serializedParsedExpression = new ExpressionLanguage\SerializedParsedExpression(
+ $rule['expression'],
+ $rule['serialized']
+ );
+
+ $found = (bool) $expressionLanguage->evaluate($serializedParsedExpression, $vars);
+ } catch (Exception $e) {
+ $found = false;
+ }
+
+ if ($found) {
+ $hook_data['filter_reasons'][] = L10n::t('Filtered by rule: %s', $rule['name']);
+ break;
+ }
}
}
}