diff --git a/include/enotify.php b/include/enotify.php index ae2e2e7fef..89a81833d0 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -465,7 +465,7 @@ function notification($params) if ($show_in_notification_page) { $notification = DI::notify()->insert([ 'name' => $params['source_name'] ?? '', - 'name_cache' => substr(strip_tags(BBCode::convert($params['source_name'] ?? '')), 0, 255), + 'name_cache' => substr(strip_tags(BBCode::convert($params['source_name'])), 0, 255), 'url' => $params['source_link'] ?? '', 'photo' => $params['source_photo'] ?? '', 'link' => $itemlink ?? '', diff --git a/mod/cal.php b/mod/cal.php index edcbaa7e8f..4b90b02cd8 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -78,7 +78,7 @@ function cal_init(App $a) '$photo' => $profile['photo'], '$addr' => $profile['addr'] ?: '', '$account_type' => $account_type, - '$about' => BBCode::convert($profile['about'] ?: ''), + '$about' => BBCode::convert($profile['about']), ]); $cal_widget = Widget\CalendarExport::getHTML(); diff --git a/mod/photos.php b/mod/photos.php index 7240c0052b..2b72fd3e4e 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -82,7 +82,7 @@ function photos_init(App $a) { '$photo' => $profile['photo'], '$addr' => $profile['addr'] ?? '', '$account_type' => $account_type, - '$about' => BBCode::convert($profile['about'] ?? ''), + '$about' => BBCode::convert($profile['about']), ]); $albums = Photo::getAlbums($a->data['user']['uid']); diff --git a/mod/videos.php b/mod/videos.php index 49c64ef973..a3344a8b43 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -67,7 +67,7 @@ function videos_init(App $a) '$photo' => $profile['photo'], '$addr' => $profile['addr'] ?? '', '$account_type' => $account_type, - '$about' => BBCode::convert($profile['about'] ?? ''), + '$about' => BBCode::convert($profile['about']), ]); // If not there, create 'aside' empty diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index fb0d99d8ac..0f3c4ad529 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1252,8 +1252,13 @@ class BBCode * @return string * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function convert($text, $try_oembed = true, $simple_html = self::INTERNAL, $for_plaintext = false) + public static function convert(string $text = null, $try_oembed = true, $simple_html = self::INTERNAL, $for_plaintext = false) { + // Accounting for null default column values + if (is_null($text) || $text === '') { + return ''; + } + $a = DI::app(); $text = self::performWithEscapedTags($text, ['code'], function ($text) use ($try_oembed, $simple_html, $for_plaintext, $a) { diff --git a/src/Model/Notify.php b/src/Model/Notify.php index fe1497316f..9ebf5c23b3 100644 --- a/src/Model/Notify.php +++ b/src/Model/Notify.php @@ -70,7 +70,7 @@ class Notify extends BaseModel private function setNameCache() { try { - $this->name_cache = strip_tags(BBCode::convert($this->source_name ?? '')); + $this->name_cache = strip_tags(BBCode::convert($this->source_name)); } catch (InternalServerErrorException $e) { } }