From 054d5f3431555bc6d646c27a79c81e4c4dd75d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Tue, 7 Nov 2017 15:34:34 +0100 Subject: [PATCH] :ambulance: fix(simpleplugin): Fix PHP error in readonly mode When showing multivaluated attributes in readonly (like when showing inherited values) it was triggering a PHP error and not working issue #5730 --- include/simpleplugin/class_Attribute.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index 146a414b0..7c523b20a 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -560,7 +560,18 @@ class Attribute { if ($this->visible) { 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) { $input = $this->renderTemplateInput(); } else { -- GitLab