Fix null value passed to string functions deprecation notices

- Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1321796513
This commit is contained in:
Hypolite Petovan 2022-11-23 13:38:40 -05:00
parent 6b555f64da
commit 0ec7238da4
6 changed files with 7 additions and 7 deletions

View file

@ -794,7 +794,7 @@ class Conversation
return []; return [];
} }
$str_blocked = str_replace(["\n", "\r"], ",", $this->pConfig->get($this->session->getLocalUserId(), 'system', 'blocked')); $str_blocked = str_replace(["\n", "\r"], ",", $this->pConfig->get($this->session->getLocalUserId(), 'system', 'blocked') ?? '');
if (empty($str_blocked)) { if (empty($str_blocked)) {
return []; return [];
} }

View file

@ -110,7 +110,7 @@ class Database
$this->connected = false; $this->connected = false;
$port = 0; $port = 0;
$serveraddr = trim($this->configCache->get('database', 'hostname')); $serveraddr = trim($this->configCache->get('database', 'hostname') ?? '');
$serverdata = explode(':', $serveraddr); $serverdata = explode(':', $serveraddr);
$host = trim($serverdata[0]); $host = trim($serverdata[0]);
if (count($serverdata) > 1) { if (count($serverdata) > 1) {

View file

@ -687,7 +687,7 @@ class Media
$previews[] = $medium['preview']; $previews[] = $medium['preview'];
} }
$type = explode('/', explode(';', $medium['mimetype'])[0]); $type = explode('/', explode(';', $medium['mimetype'] ?? '')[0]);
if (count($type) < 2) { if (count($type) < 2) {
Logger::info('Unknown MimeType', ['type' => $type, 'media' => $medium]); Logger::info('Unknown MimeType', ['type' => $type, 'media' => $medium]);
$filetype = 'unkn'; $filetype = 'unkn';

View file

@ -324,8 +324,8 @@ class Site extends BaseAdmin
/* Installed langs */ /* Installed langs */
$lang_choices = DI::l10n()->getAvailableLanguages(); $lang_choices = DI::l10n()->getAvailableLanguages();
if (strlen(DI::config()->get('system', 'directory_submit_url')) && if (DI::config()->get('system', 'directory_submit_url') &&
!strlen(DI::config()->get('system', 'directory'))) { !DI::config()->get('system', 'directory')) {
DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url'))); DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url')));
DI::config()->delete('system', 'directory_submit_url'); DI::config()->delete('system', 'directory_submit_url');
} }

View file

@ -327,7 +327,7 @@ class Profile extends BaseModule
'$submit' => $this->t('Submit'), '$submit' => $this->t('Submit'),
'$lbl_info1' => $lbl_info1, '$lbl_info1' => $lbl_info1,
'$lbl_info2' => $this->t('Their personal note'), '$lbl_info2' => $this->t('Their personal note'),
'$reason' => trim($contact['reason']), '$reason' => trim($contact['reason'] ?? ''),
'$infedit' => $this->t('Edit contact notes'), '$infedit' => $this->t('Edit contact notes'),
'$common_link' => 'contact/' . $contact['id'] . '/contacts/common', '$common_link' => 'contact/' . $contact['id'] . '/contacts/common',
'$relation_text' => $relation_text, '$relation_text' => $relation_text,

View file

@ -233,7 +233,7 @@ class PortableContacts extends BaseModule
} }
if ($selectedFields['tags']) { if ($selectedFields['tags']) {
$tags = str_replace(',', ' ', $contact['keywords']); $tags = str_replace(',', ' ', $contact['keywords'] ?? '');
$tags = explode(' ', $tags); $tags = explode(' ', $tags);
$cleaned = []; $cleaned = [];