diff --git a/src/HTMLBuilder/Handler/SelectHandler.php b/src/HTMLBuilder/Handler/SelectHandler.php index 4b9726909..b2f0c4a30 100755 --- a/src/HTMLBuilder/Handler/SelectHandler.php +++ b/src/HTMLBuilder/Handler/SelectHandler.php @@ -173,8 +173,7 @@ class SelectHandler implements HandlerInterface // Leggo ulteriori campi oltre a id e descrizione per inserirli nell'option nella forma "data-nomecampo1", "data-nomecampo2", ecc unset($element['optgroup']); - $attributes[] = "data-select-attributes='".replace(json_encode($element), ["'" => "\'"])."'"; - + $attributes[] = "data-select-attributes='".htmlspecialchars(json_encode($element), ENT_QUOTES)."'"; $html .= ' '; } @@ -226,8 +225,7 @@ class SelectHandler implements HandlerInterface // Leggo ulteriori campi oltre a id e descrizione per inserirli nell'option nella forma "data-nomecampo1", "data-nomecampo2", ecc unset($element['optgroup']); - $attributes[] = "data-select-attributes='".replace(json_encode($element), ["'" => "\'"])."'"; - + $attributes[] = "data-select-attributes='".htmlspecialchars(json_encode($element), ENT_QUOTES)."'"; $result .= ' '; }