Hey, because i cannot answer/post in the original posting i am posting a probable fix for this issue:
The warning is caused by this line:
list($home, $stuff) = explode('/', $stuff, 2);The same problem can also occur with the site URL parsing:
list($domain, $stuff2) = explode('/', $stuff2, 2);I probable fix might be (tested):
public static function useAntiLeeching()
{
$app = Factory::getApplication();
$params = $app->getParams();
$baseUri = Uri::getInstance(Uri::base(false));
$domain = strtolower($baseUri->getHost());
$domain = preg_replace('/^www\./i', '', $domain);
$referer = $_SERVER['HTTP_REFERER'] ?? '';
$refererUri = $referer !== '' ? Uri::getInstance($referer) : null;
$home = '';
if ($refererUri !== null) {
$home = strtolower($refererUri->getHost());
$home = preg_replace('/^www\./i', '', $home);
}
$blocking = false;
if ($params->get('check_leeching')) {
if ($referer === '') {
$blocking = (bool) $params->get('block_referer_is_empty');
} elseif ($home !== '' && $home !== $domain) {
$allowedUrls = array_filter(array_map(
static function ($host) {
$host = strtolower(trim($host));
return preg_replace('/^www\./i', '', $host);
},
explode(',', (string) $params->get('allowed_leeching_sites', ''))
));
if (!in_array($home, $allowedUrls, true)) {
$blocking = true;
}
}
}
// Check blacklist
if ($params->get('use_blocking_list')
&& $params->get('blocking_list') !== '') {
$userIp = self::getRealIp();
$blockingList = explode(
"\n",
str_replace("\r", '', (string) $params->get('blocking_list'))
);
if (self::inIpRange($userIp, $blockingList)) {
$blocking = true;
}
}
return $blocking;
}
Replace the block
public static function useAntiLeeching()
!
Please test & verify!