From 918e6823a9ec2e14733a553a60505885edd93214 Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Mon, 20 Dec 2021 16:25:10 +0000 Subject: [PATCH] [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. --- src/Entity/Actor.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Entity/Actor.php b/src/Entity/Actor.php index 53333d77b8..ca9d1e6021 100644 --- a/src/Entity/Actor.php +++ b/src/Entity/Actor.php @@ -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);