diff --git a/classes/module/Module.php b/classes/module/Module.php index af5e49ddc95ea..d1cd1d9729e3e 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -3102,6 +3102,7 @@ public function getTranslator() protected function trans($id, array $parameters = array(), $domain = null, $locale = null) { + $parameters['legacy'] = 'htmlspecialchars'; return $this->getTranslator()->trans($id, $parameters, $domain, $locale); } } diff --git a/config/smartyadmin.config.inc.php b/config/smartyadmin.config.inc.php index ff9104c70c2ab..da5a4e665c232 100644 --- a/config/smartyadmin.config.inc.php +++ b/config/smartyadmin.config.inc.php @@ -61,7 +61,7 @@ function smartyTranslate($params, &$smarty) $isInModule = isset($params['mod']) && !empty($params['mod']); $sprintf = isset($params['sprintf']) ? $params['sprintf'] : array(); - if ($htmlEntities || $addSlashes) { + if (($htmlEntities || $addSlashes) && is_array($sprintf) && !empty($sprintf)) { $sprintf['legacy'] = $htmlEntities ? 'htmlspecialchars': 'addslashes'; } diff --git a/src/PrestaShopBundle/Translation/PrestaShopTranslatorTrait.php b/src/PrestaShopBundle/Translation/PrestaShopTranslatorTrait.php index ecf13b9eeb377..e68ad3289ea8d 100644 --- a/src/PrestaShopBundle/Translation/PrestaShopTranslatorTrait.php +++ b/src/PrestaShopBundle/Translation/PrestaShopTranslatorTrait.php @@ -40,10 +40,9 @@ public function trans($id, array $parameters = array(), $domain = null, $locale if (!$this->isSprintfString($id) || empty($parameters)) { $translated = parent::trans($id, $parameters, $domain, $locale); - if (isset($parameters['legacy'])) { - $translated = call_user_func($parameters['legacy'],$translated); - } - }else { + $parameters['legacy'] = 'htmlspecialchars'; + $translated = call_user_func($parameters['legacy'], $translated); + } else { $translated = vsprintf(parent::trans($id, array(), $domain, $locale), $parameters); }