Skip to content

Commit

Permalink
fix(selectfield,multiselectfield): fix possible encoding problem
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Jun 19, 2023
1 parent e9badc4 commit 8aaec8a
Show file tree
Hide file tree
Showing 6 changed files with 446 additions and 4 deletions.
5 changes: 4 additions & 1 deletion inc/field/multiselectfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

use Dropdown;
use Html;
use Glpi\Toolbox\Sanitizer;

class MultiSelectField extends CheckboxesField
{
Expand All @@ -55,8 +56,10 @@ public function getRenderedHtml($domain, $canEdit = true): string {
$fieldName = 'formcreator_field_' . $id;
$values = $this->getAvailableValues();
$translatedValues = [];

foreach ($values as $key => $value) {
$translatedValues[$key] = __($value, $domain);
$unsanitized = Sanitizer::unsanitize(__($value, $domain));
$translatedValues[$key] = $unsanitized;
}
if (!empty($values)) {
$html .= Dropdown::showFromArray($fieldName, $translatedValues, [
Expand Down
2 changes: 1 addition & 1 deletion inc/formanswer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ protected function validateFormAnswer($input): bool {
);
}

$this->isAnswersValid = false;
$this->isAnswersValid = false;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class PluginFormcreatorInstall {
'2.13.3' => '2.13.4',
'2.13.4' => '2.13.5',
'2.13.5' => '2.13.6',
'2.13.6' => '2.13.7',
];

protected bool $resyncIssues = false;
Expand Down
Loading

0 comments on commit 8aaec8a

Please sign in to comment.