From 4d82beb46a2444df90e5aeb7d8cb9abb2c767c7b Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 30 Dec 2024 13:59:28 +0100 Subject: [PATCH] Fix phpstan doleditor content cannot be nullable --- htdocs/core/class/doleditor.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 8f2c9faf506..064db79b3da 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -210,7 +210,7 @@ class DolEditor $found = 0; $out = ''; - $this->content = ($this->content ?? ''); // to avoid htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated + $content = (string) $this->content; // to avoid htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated if (in_array($this->tool, array('textarea', 'ckeditor'))) { $found = 1; @@ -223,7 +223,7 @@ class DolEditor $out .= (preg_match('/%/', $this->cols) ? ' style="margin-top: 5px; width: '.$this->cols.'"' : ' cols="'.$this->cols.'"'); $out .= ' '.($moreparam ? $moreparam : ''); $out .= ' class="flat '.$morecss.'">'; - $out .= htmlspecialchars($this->content); + $out .= htmlspecialchars($content); $out .= ''; if ($this->tool == 'ckeditor' && !empty($conf->use_javascript_ajax) && isModEnabled('fckeditor')) { @@ -390,12 +390,12 @@ class DolEditor $out .= ($this->height ? ' height: '.$this->height.'px; ' : ''); //$out.=" min-height: 100px;"; $out .= '">'; - $out .= htmlspecialchars($this->content); + $out .= htmlspecialchars($content); $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= '