Commit ad7389cf authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch...

Merge branch '5730-php-error-htmlentities-expects-parameter-1-to-be-string-array-given-usr-share-fusiondirectory-include-simpleplugin-class_attribute-inc-line-563' into '1.3-dev'

Resolve "PHP error: htmlentities() expects parameter 1 to be string, array given (/usr/share/fusiondirectory/include/simpleplugin/class_Attribute.inc, line 563)"

See merge request fusiondirectory/fd!72

(cherry picked from commit 87ca56dd)

054d5f34 :ambulance: fix(simpleplugin): Fix PHP error in readonly mode
Showing with 12 additions and 1 deletion
+12 -1
...@@ -566,7 +566,18 @@ class Attribute ...@@ -566,7 +566,18 @@ class Attribute
{ {
if ($this->visible) { if ($this->visible) {
if ($readOnly) { if ($readOnly) {
$input = '{literal}'.htmlentities($this->getValue(), ENT_COMPAT, 'UTF-8').'{/literal}'; $value = $this->getValue();
if (is_array($value)) {
$input = '{literal}'.implode('<br/>', array_map(
function ($v)
{
return htmlentities($v, ENT_COMPAT, 'UTF-8');
},
$value
)).'{/literal}';
} else {
$input = '{literal}'.htmlentities($value, ENT_COMPAT, 'UTF-8').'{/literal}';
}
} elseif (is_object($this->plugin) && $this->plugin->is_template) { } elseif (is_object($this->plugin) && $this->plugin->is_template) {
$input = $this->renderTemplateInput(); $input = $this->renderTemplateInput();
} else { } else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment