$attachments should aways be an array

In order to avoid a PHP 7.2 error when using count()
This commit is contained in:
Pierre Rudloff 2018-04-24 16:22:29 +02:00
parent 23371880e8
commit 9bb11ccfa5

View File

@ -2716,7 +2716,7 @@ function api_convert_item($item)
* *
* @param string $body * @param string $body
* *
* @return array|false * @return array
*/ */
function api_get_attachments(&$body) function api_get_attachments(&$body)
{ {
@ -2727,7 +2727,7 @@ function api_get_attachments(&$body)
$ret = preg_match_all("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $text, $images); $ret = preg_match_all("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $text, $images);
if (!$ret) { if (!$ret) {
return false; return [];
} }
$attachments = []; $attachments = [];