From df7ec0cdf7fdaf75a5897016f69254a97066f429 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Tue, 27 Aug 2019 08:27:07 +0200 Subject: [PATCH] php notice fixings addons: - bufferapp (missing errorcode) - twitter (wrong field name 'nickname') core: - bbcode (incomplete attachementdata) - crypto (uninitialized key) --- src/Content/Text/BBCode.php | 11 ++++++++++- src/Util/Crypto.php | 10 ++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index c16041e220..bd4fc73c15 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -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); diff --git a/src/Util/Crypto.php b/src/Util/Crypto.php index 78f7c349a7..a45fdf9faa 100644 --- a/src/Util/Crypto.php +++ b/src/Util/Crypto.php @@ -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); + } } /** -- 2.39.5