]> git.mxchange.org Git - friendica.git/commitdiff
php notice fixings
authorPhilipp Holzer <admin+github@philipp.info>
Tue, 27 Aug 2019 06:27:07 +0000 (08:27 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Tue, 27 Aug 2019 06:27:07 +0000 (08:27 +0200)
addons:
- bufferapp (missing errorcode)
- twitter (wrong field name 'nickname')
core:
- bbcode (incomplete attachementdata)
- crypto (uninitialized key)

src/Content/Text/BBCode.php
src/Util/Crypto.php

index c16041e2207df7fe929a8cb040afd91e067f61c0..bd4fc73c15221069a5a042204718fb7c50128aaf 100644 (file)
@@ -120,7 +120,16 @@ class BBCode extends BaseObject
         */
        public static function getAttachmentData($body)
        {
-               $data = [];
+               // Initialize empty data array
+               $data = [
+                       'type'        => '',
+                       'text'        => '',
+                       'after'       => '',
+                       'image'       => null,
+                       'url'         => '',
+                       'title'       => '',
+                       'description' => '',
+               ];
 
                if (!preg_match("/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/ism", $body, $match)) {
                        return self::getOldAttachmentData($body);
index 78f7c349a71eb855e2f05ebb3d8c528b4adcc83e..a45fdf9faac6732768577c9d86123acaa6ac4294 100644 (file)
@@ -4,12 +4,12 @@
  */
 namespace Friendica\Util;
 
+use ASN_BASE;
+use ASNValue;
 use Friendica\Core\Config;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Core\System;
-use ASN_BASE;
-use ASNValue;
 
 /**
  * @brief Crypto class
@@ -209,8 +209,10 @@ class Crypto
 
                $r = ASN_BASE::parseASNString($x);
 
-               $m = Strings::base64UrlDecode($r[0]->asnData[1]->asnData[0]->asnData[0]->asnData);
-               $e = Strings::base64UrlDecode($r[0]->asnData[1]->asnData[0]->asnData[1]->asnData);
+               if (isset($r[0])) {
+                       $m = Strings::base64UrlDecode($r[0]->asnData[1]->asnData[0]->asnData[0]->asnData);
+                       $e = Strings::base64UrlDecode($r[0]->asnData[1]->asnData[0]->asnData[1]->asnData);
+               }
        }
 
        /**