Skip to content

Commit 2971ba1

Browse files
committed
(fix): search indexer crash due to tags becoming array - #2317
1 parent dba3bce commit 2971ba1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Helpers/Text.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ public static function getHashtags($fullText): array
125125

126126
preg_match_all($htRe, $fullText, $matches);
127127

128-
return $matches[2] ?? [];
128+
return array_filter($matches[2] ?? [], function ($tag) {
129+
return is_string($tag);
130+
});
129131
}
130132

131133
/**

classes/ElggEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ public function getTags()
15451545
{
15461546
// There is a bug on mobile that is sending the hashtags with the hash, this shouldnt happen
15471547
$this->tags = array_map(function ($tag) {
1548-
return str_replace('#', '', $tag);
1548+
return (string) str_replace('#', '', $tag);
15491549
}, $this->tags ?: []);
15501550
return $this->tags ?: [];
15511551
}

0 commit comments

Comments
 (0)