Merge pull request #12735 from MrPetovan/bug/fatal-errors

Address a couple of Fatal errors
This commit is contained in:
Michael Vogel 2023-01-27 08:55:27 +01:00 committed by GitHub
commit fc46778a00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -583,7 +583,7 @@ class Photo
$photo_failure = false;
$filename = basename($image_url);
if (!empty($image_url)) {
if (!empty($image_url) && @parse_url($image_url, PHP_URL_HOST)) {
$ret = DI::httpClient()->get($image_url, HttpClientAccept::IMAGE);
Logger::debug('Got picture', ['Content-Type' => $ret->getHeader('Content-Type'), 'url' => $image_url]);
$img_str = $ret->getBody();

View file

@ -45,7 +45,7 @@ class Stats extends BaseDataTransferObject
{
if (!empty($config->get('system', 'nodeinfo'))) {
$this->user_count = intval(DI::keyValue()->get('nodeinfo_total_users'));
$this->status_count = DI::keyValue()->get('nodeinfo_local_posts') + DI::keyValue()->get('nodeinfo_local_comments');
$this->status_count = (int)DI::keyValue()->get('nodeinfo_local_posts') + (int)DI::keyValue()->get('nodeinfo_local_comments');
$this->domain_count = $database->count('gserver', ["`network` in (?, ?) AND NOT `failed` AND NOT `blocked`", Protocol::DFRN, Protocol::ACTIVITYPUB]);
}
}