From 71cc3a77734796db8691ac2289fd53ee2137c4bb Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 24 Jul 2010 13:49:43 +0200 Subject: [PATCH] [Form] avoid double-escape and then unescape htmlspecialchars' fourth parameter allows you to avoid double-escaping in the first place --- src/Symfony/Component/Form/HtmlGenerator.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/Symfony/Component/Form/HtmlGenerator.php b/src/Symfony/Component/Form/HtmlGenerator.php index 1f2d07634c5f..2030ea341f45 100644 --- a/src/Symfony/Component/Form/HtmlGenerator.php +++ b/src/Symfony/Component/Form/HtmlGenerator.php @@ -120,18 +120,6 @@ private function attributesCallback($name, $value) */ public function escape($value) { - return $this->fixDoubleEscape(htmlspecialchars((string) $value, ENT_QUOTES, $this->charset)); - } - - /** - * Fixes double escaped strings. - * - * @param string $escaped string to fix - * - * @return string A single escaped string - */ - protected function fixDoubleEscape($escaped) - { - return preg_replace('/&([a-z]+|(#\d+)|(#x[\da-f]+));/i', '&$1;', $escaped); + return htmlspecialchars((string) $value, ENT_QUOTES, $this->charset, false); } }