From d2924e641bb87169aff52a8f1fa3103ac93b3d39 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 6 Sep 2022 12:15:44 +0100 Subject: [PATCH] MDL-75656 tag: decode entities in tags element values. --- lib/form/tags.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/form/tags.php b/lib/form/tags.php index 28468134ac0..b1ac99f3fed 100644 --- a/lib/form/tags.php +++ b/lib/form/tags.php @@ -251,6 +251,13 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete { return $this->_prepareValue([], $assoc); } + // Submitted tag data will be encoded, we want original text. + if (array_key_exists($this->getName(), $submitValues)) { + array_walk($submitValues[$this->getName()], static function(string &$tag): void { + $tag = html_entity_decode($tag); + }); + } + return parent::exportValue($submitValues, $assoc); }