Skip to content

Commit d259f4f

Browse files
committed
Fix more PHP 8 issues
1 parent 7be2559 commit d259f4f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/wcmf/application/views/plugins/modifier.filter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
* @return Array
2727
*/
2828
function smarty_modifier_filter($objects, $attribute, $regex, $invert=false) {
29-
return array_filter($objects, function($obj) use ($attribute, $regex, $invert) {
29+
return is_array($objects) ? array_filter($objects, function($obj) use ($attribute, $regex, $invert) {
3030
$match = preg_match($regex, $obj->getValue($attribute));
3131
return $invert ? !$match : $match;
32-
});
32+
}) : [];
3333
}
3434
?>

src/wcmf/lib/presentation/link/LinkProcessor.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ public static function processLinks($node, $base, LinkProcessorStrategy $strateg
5454
$oldValue = $value;
5555

5656
// find links in texts
57-
$urls = array_fill_keys(StringUtil::getUrls($value), 'embedded');
58-
// find direct attribute urls
59-
if (preg_match('/^[a-zA-Z]+:\/\//', $value) || InternalLink::isLink($value)) {
60-
$urls[$value] = 'direct';
57+
$urls = [];
58+
if (is_string($value)) {
59+
$urls = array_fill_keys(StringUtil::getUrls($value), 'embedded');
60+
// find direct attribute urls
61+
if (preg_match('/^[a-zA-Z]+:\/\//', $value) || InternalLink::isLink($value)) {
62+
$urls[$value] = 'direct';
63+
}
6164
}
6265

6366
// process urls

0 commit comments

Comments
 (0)