[OStatus] null being returned instead of an empty array
Fixes: "Invalid argument supplied for foreach" in onEndFindMentions
This commit is contained in:
parent
5ea0d74a57
commit
db9bb6b5a1
@ -30,7 +30,7 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
|||||||
|
|
||||||
class OStatusPlugin extends Plugin
|
class OStatusPlugin extends Plugin
|
||||||
{
|
{
|
||||||
const PLUGIN_VERSION = '2.0.1';
|
const PLUGIN_VERSION = '2.0.2';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook for RouterInitialized event.
|
* Hook for RouterInitialized event.
|
||||||
@ -274,6 +274,7 @@ class OStatusPlugin extends Plugin
|
|||||||
PREG_OFFSET_CAPTURE);
|
PREG_OFFSET_CAPTURE);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
common_log(LOG_ERR, __METHOD__ . ': Error parsing webfinger IDs from text (preg_last_error=='.preg_last_error().').');
|
common_log(LOG_ERR, __METHOD__ . ': Error parsing webfinger IDs from text (preg_last_error=='.preg_last_error().').');
|
||||||
|
return [];
|
||||||
} elseif (count($wmatches)) {
|
} elseif (count($wmatches)) {
|
||||||
common_debug(sprintf('Found %d matches for WebFinger IDs: %s', count($wmatches), _ve($wmatches)));
|
common_debug(sprintf('Found %d matches for WebFinger IDs: %s', count($wmatches), _ve($wmatches)));
|
||||||
}
|
}
|
||||||
@ -298,6 +299,7 @@ class OStatusPlugin extends Plugin
|
|||||||
PREG_OFFSET_CAPTURE);
|
PREG_OFFSET_CAPTURE);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
common_log(LOG_ERR, __METHOD__ . ': Error parsing profile URL mentions from text (preg_last_error=='.preg_last_error().').');
|
common_log(LOG_ERR, __METHOD__ . ': Error parsing profile URL mentions from text (preg_last_error=='.preg_last_error().').');
|
||||||
|
return [];
|
||||||
} elseif (count($wmatches)) {
|
} elseif (count($wmatches)) {
|
||||||
common_debug(sprintf('Found %d matches for profile URL mentions: %s', count($wmatches), _ve($wmatches)));
|
common_debug(sprintf('Found %d matches for profile URL mentions: %s', count($wmatches), _ve($wmatches)));
|
||||||
}
|
}
|
||||||
@ -593,7 +595,7 @@ class OStatusPlugin extends Plugin
|
|||||||
try {
|
try {
|
||||||
$url = $notice->getUrl();
|
$url = $notice->getUrl();
|
||||||
// If getUrl() throws exception, $url is never set
|
// If getUrl() throws exception, $url is never set
|
||||||
|
|
||||||
$bits = parse_url($url);
|
$bits = parse_url($url);
|
||||||
$domain = $bits['host'];
|
$domain = $bits['host'];
|
||||||
if (substr($domain, 0, 4) == 'www.') {
|
if (substr($domain, 0, 4) == 'www.') {
|
||||||
|
Loading…
Reference in New Issue
Block a user