summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2022-05-03 21:47:57 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2022-05-04 18:14:37 +0200
commit0fb620244df60eb9daceab87c17a5e26ff2620ed (patch)
treef71eb51513904d20cd71ae425a827eb84d0d4afe
parente8b00fa648b5ac74a9b9e95b26bf7799cfce7569 (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>
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/Db/Item.php12
2 files changed, 9 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99fc8477f..ea0add23e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ The format is mostly based on [Keep a Changelog](https://keepachangelog.com/en/1
### Fixed
- Fix updated api not returning any item after marking item as read (#1713)
+- Fix deprecation warning for strip_tags() on a null value (#1766)
# Releases
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');