Merge pull request #12642 from MrPetovan/bug/fatal-errors
Address a few Fatal Errors
This commit is contained in:
commit
4eea80bdd9
5 changed files with 20 additions and 4 deletions
|
@ -253,12 +253,12 @@ class System
|
|||
$func['database'] = in_array($func['class'], ['Friendica\Database\DBA', 'Friendica\Database\Database']);
|
||||
if (!$previous['database'] || !$func['database']) {
|
||||
$classparts = explode("\\", $func['class']);
|
||||
$callstack[] = array_pop($classparts).'::'.$func['function'];
|
||||
$callstack[] = array_pop($classparts).'::'.$func['function'] . '(' . $func['line'] . ')';
|
||||
$previous = $func;
|
||||
}
|
||||
} elseif (!in_array($func['function'], $ignore)) {
|
||||
$func['database'] = ($func['function'] == 'q');
|
||||
$callstack[] = $func['function'];
|
||||
$callstack[] = $func['function'] . '(' . $func['line'] . ')';
|
||||
$func['class'] = '';
|
||||
$previous = $func;
|
||||
}
|
||||
|
|
|
@ -81,4 +81,14 @@ class ItemURI
|
|||
|
||||
return $itemuri['id'] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $uriId
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function exists(int $uriId): bool
|
||||
{
|
||||
return DBA::exists('item-uri', ['id' => $uriId]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\ItemURI;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||
|
@ -89,6 +90,11 @@ class Media
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ItemURI::exists($media['uri-id'])) {
|
||||
Logger::info('Media referenced URI ID not found', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'callstack' => System::callstack()]);
|
||||
return;
|
||||
}
|
||||
|
||||
$media = self::unsetEmptyFields($media);
|
||||
$media = DI::dbaDefinition()->truncateFieldsForTable('post-media', $media);
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class Tag
|
|||
$tag = DBA::selectFirst('tag', ['name', 'type'], ['url' => $url]);
|
||||
if (!empty($tag)) {
|
||||
if ($tag['name'] != substr($name, 0, 96)) {
|
||||
DBA::update('tag', ['name' => substr($name, 0, 96)], ['url' => $url]);
|
||||
DBA::update('tag', ['name' => substr($name, 0, 96)], ['url' => $url, 'type' => $tag['type']]);
|
||||
}
|
||||
if (!empty($target) && ($tag['type'] != $target)) {
|
||||
DBA::update('tag', ['type' => $target], ['url' => $url]);
|
||||
|
|
|
@ -196,7 +196,7 @@ class Image
|
|||
public function isValid(): bool
|
||||
{
|
||||
if ($this->isImagick()) {
|
||||
return ($this->image !== false);
|
||||
return !empty($this->image);
|
||||
}
|
||||
return $this->valid;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue