[ENTITY][Actor] Init Actor's class variable homepage, bio, and location to null

The template cards/profile/view.html.twig tries to access the bio variable before it's initialized, an is null check was already in place. However, even then, the variable needs to be init beforehand. The same change was applied to homepage and location since they might lead to similar issues.
This commit is contained in:
Eliseu Amaro 2021-12-20 16:25:10 +00:00
parent 622057ba0d
commit 918e6823a9
No known key found for this signature in database
GPG Key ID: 96DA09D4B97BC2D5

View File

@ -60,9 +60,9 @@ class Actor extends Entity
private ?string $fullname = null;
private int $roles = 4;
private int $type;
private ?string $homepage;
private ?string $bio;
private ?string $location;
private ?string $homepage = null;
private ?string $bio = null;
private ?string $location = null;
private ?float $lat;
private ?float $lon;
private ?int $location_id;
@ -378,12 +378,12 @@ class Actor extends Entity
}
/**
* @param array $tags array of strings to become self tags
* @param array $tags array of strings to become self tags
* @param null|array $existing array of existing self tags (ActorTag[])
*
* @return $this
*/
public function setSelfTags(array $tags, ?array $existing = null): self
public function setSelfTags(array $tags, ?array $existing = null): self
{
$tags = F\filter($tags, fn ($tag) => Nickname::isCanonical($tag)); // TODO: Have an actual #Tag test
$tags = array_unique($tags);