]> git.mxchange.org Git - friendica.git/commitdiff
Fix null value passed to string functions deprecation notices
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 23 Nov 2022 18:38:40 +0000 (13:38 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 25 Nov 2022 13:13:05 +0000 (08:13 -0500)
- Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1321796513

src/Content/Conversation.php
src/Database/Database.php
src/Model/Post/Media.php
src/Module/Admin/Site.php
src/Module/Contact/Profile.php
src/Module/User/PortableContacts.php

index be7448a336a12f0646f81b1aa05db659452b7d97..6d19eb16356ce450d22f7ee4714a167285b948c8 100644 (file)
@@ -794,7 +794,7 @@ class Conversation
                        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)) {
                        return [];
                }
index a34b17adbe17ea1814c0d7eff6f46b7e3b49ca9f..036e6ec2cbf6d8ad52d2cce7a4d058f42af60684 100644 (file)
@@ -110,7 +110,7 @@ class Database
                $this->connected = false;
 
                $port       = 0;
-               $serveraddr = trim($this->configCache->get('database', 'hostname'));
+               $serveraddr = trim($this->configCache->get('database', 'hostname') ?? '');
                $serverdata = explode(':', $serveraddr);
                $host       = trim($serverdata[0]);
                if (count($serverdata) > 1) {
index 04c0db0f80aefea2ed8583a69b6dbe3fe706bbab..854e5d8f91335e435e08a1db60ec47af69463954 100644 (file)
@@ -687,7 +687,7 @@ class Media
                                $previews[] = $medium['preview'];
                        }
 
-                       $type = explode('/', explode(';', $medium['mimetype'])[0]);
+                       $type = explode('/', explode(';', $medium['mimetype'] ?? '')[0]);
                        if (count($type) < 2) {
                                Logger::info('Unknown MimeType', ['type' => $type, 'media' => $medium]);
                                $filetype = 'unkn';
index f7fc9d7934e5a20d998c58a10aa2f98ae2098c43..ab6624f776b2912ae2ba9ff4a7a236f11bbfea18 100644 (file)
@@ -324,8 +324,8 @@ class Site extends BaseAdmin
                /* Installed langs */
                $lang_choices = DI::l10n()->getAvailableLanguages();
 
-               if (strlen(DI::config()->get('system', 'directory_submit_url')) &&
-                       !strlen(DI::config()->get('system', 'directory'))) {
+               if (DI::config()->get('system', 'directory_submit_url') &&
+                       !DI::config()->get('system', 'directory')) {
                        DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url')));
                        DI::config()->delete('system', 'directory_submit_url');
                }
index b3d0c037339e8c5154e53e56a1f54d079a0ca390..eadc67818d506751551aa1fcae08200afd1c7b62 100644 (file)
@@ -327,7 +327,7 @@ class Profile extends BaseModule
                        '$submit'                    => $this->t('Submit'),
                        '$lbl_info1'                 => $lbl_info1,
                        '$lbl_info2'                 => $this->t('Their personal note'),
-                       '$reason'                    => trim($contact['reason']),
+                       '$reason'                    => trim($contact['reason'] ?? ''),
                        '$infedit'                   => $this->t('Edit contact notes'),
                        '$common_link'               => 'contact/' . $contact['id'] . '/contacts/common',
                        '$relation_text'             => $relation_text,
index 6629994810e2a6950bc6c3bda47a08b68226a12f..6a3c1201d972437bdd624487eb0ed8d624a60fae 100644 (file)
@@ -233,7 +233,7 @@ class PortableContacts extends BaseModule
                        }
 
                        if ($selectedFields['tags']) {
-                               $tags = str_replace(',', ' ', $contact['keywords']);
+                               $tags = str_replace(',', ' ', $contact['keywords'] ?? '');
                                $tags = explode(' ', $tags);
 
                                $cleaned = [];