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 .= '