[advancedcontentfilter] Fix PHP Warning: Invalid argument supplied for foreach
This commit is contained in:
parent
b0dba96b0d
commit
ea9ec0dadf
1 changed files with 15 additions and 13 deletions
|
@ -118,21 +118,23 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($rules as $rule) {
|
if ($rules) {
|
||||||
try {
|
foreach($rules as $rule) {
|
||||||
$serializedParsedExpression = new ExpressionLanguage\SerializedParsedExpression(
|
try {
|
||||||
$rule['expression'],
|
$serializedParsedExpression = new ExpressionLanguage\SerializedParsedExpression(
|
||||||
$rule['serialized']
|
$rule['expression'],
|
||||||
);
|
$rule['serialized']
|
||||||
|
);
|
||||||
|
|
||||||
$found = (bool) $expressionLanguage->evaluate($serializedParsedExpression, $vars);
|
$found = (bool) $expressionLanguage->evaluate($serializedParsedExpression, $vars);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$found = false;
|
$found = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($found) {
|
if ($found) {
|
||||||
$hook_data['filter_reasons'][] = L10n::t('Filtered by rule: %s', $rule['name']);
|
$hook_data['filter_reasons'][] = L10n::t('Filtered by rule: %s', $rule['name']);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue