diff options
author | Benjamin Brahmer <info@b-brahmer.de> | 2022-05-03 21:47:57 +0200 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2022-05-04 18:14:37 +0200 |
commit | 0fb620244df60eb9daceab87c17a5e26ff2620ed (patch) | |
tree | f71eb51513904d20cd71ae425a827eb84d0d4afe /lib/Db | |
parent | e8b00fa648b5ac74a9b9e95b26bf7799cfce7569 (diff) |
check if variable is null before striping tags
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
Co-authored-by: Sean Molenaar <SMillerDev@users.noreply.github.com>
Diffstat (limited to 'lib/Db')
-rw-r--r-- | lib/Db/Item.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Db/Item.php b/lib/Db/Item.php index 693b9417c..b30bd31cf 100644 --- a/lib/Db/Item.php +++ b/lib/Db/Item.php @@ -383,8 +383,10 @@ class Item extends Entity implements IAPI, \JsonSerializable public function setAuthor(string $author = null): self { - $author = strip_tags($author); - + if (!is_null($author)) { + $author = strip_tags($author); + } + if ($this->author !== $author) { $this->author = $author; $this->markFieldUpdated('author'); @@ -549,8 +551,10 @@ class Item extends Entity implements IAPI, \JsonSerializable public function setTitle(string $title = null): self { - $title = trim(strip_tags($title)); - + if (!is_null($title)) { + $title = trim(strip_tags($title)); + } + if ($this->title !== $title) { $this->title = $title; $this->markFieldUpdated('title'); |