From 527c17a8a7d536f24dae26eb6b008b3c84207502 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 6 May 2023 23:55:34 -0400 Subject: [PATCH] Rework Hashtag module to avoid undefined key error - Address https://github.com/friendica/friendica/issues/13025#issuecomment-1537143590 --- src/Module/Hashtag.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index dd0c94d8fa..0c4c41c7e1 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -31,23 +31,25 @@ use Friendica\Util\Strings; */ class Hashtag extends BaseModule { - protected function content(array $request = []): string + protected function rawContent(array $request = []) { $result = []; - $t = Strings::escapeHtml($_REQUEST['t']); - if (empty($t)) { + if (empty($request['t'])) { System::jsonExit($result); } - $taglist = DBA::select('tag', ['name'], ["`name` LIKE ?", $t . "%"], ['order' => ['name'], 'limit' => 100]); + $taglist = DBA::select( + 'tag', + ['name'], + ["`name` LIKE ?", Strings::escapeHtml($request['t']) . "%"], + ['order' => ['name'], 'limit' => 100] + ); while ($tag = DBA::fetch($taglist)) { $result[] = ['text' => $tag['name']]; } DBA::close($taglist); System::jsonExit($result); - - return ''; } } -- 2.39.5