Merge pull request #12264 from annando/error

Fix "Argument #1 ($parts) must be of type array, bool given"
This commit is contained in:
Hypolite Petovan 2022-11-25 08:05:10 -05:00 committed by GitHub
commit 01558d6dda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,12 +115,12 @@ class GServer
*/
public static function getID(string $url, bool $no_check = false): ?int
{
$url = self::cleanURL($url);
if (empty($url)) {
return null;
}
$url = self::cleanURL($url);
$gserver = DBA::selectFirst('gserver', ['id'], ['nurl' => Strings::normaliseLink($url)]);
if (DBA::isResult($gserver)) {
Logger::debug('Got ID for URL', ['id' => $gserver['id'], 'url' => $url, 'callstack' => System::callstack(20)]);
@ -323,6 +323,10 @@ class GServer
$url = str_replace('/index.php', '', $url);
$urlparts = parse_url($url);
if (empty($urlparts)) {
return '';
}
unset($urlparts['user']);
unset($urlparts['pass']);
unset($urlparts['query']);