From f51a6f7de975900f6e7a240b29b1e5e7215f0091 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sun, 10 Apr 2011 12:45:02 +0100 Subject: [PATCH] Color keywords now case-insensitive. Signed-off-by: Edward Z. Yang --- NEWS | 4 ++++ library/HTMLPurifier/AttrDef/HTML/Color.php | 2 +- .../HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 8e7aef02..a90f38b6 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier . Internal change ========================== +4.3.1, unknown release date +- Color keywords are now case insensitive. Thanks Yzmir Ramirez + for reporting. + 4.3.0, released 2011-03-27 # Fixed broken caching of customized raw definitions, but requires an API change. The old API still works but will emit a warning, diff --git a/library/HTMLPurifier/AttrDef/HTML/Color.php b/library/HTMLPurifier/AttrDef/HTML/Color.php index d01e2045..00d86572 100644 --- a/library/HTMLPurifier/AttrDef/HTML/Color.php +++ b/library/HTMLPurifier/AttrDef/HTML/Color.php @@ -14,7 +14,7 @@ class HTMLPurifier_AttrDef_HTML_Color extends HTMLPurifier_AttrDef $string = trim($string); if (empty($string)) return false; - if (isset($colors[$string])) return $colors[$string]; + if (isset($colors[strtolower($string)])) return $colors[$string]; if ($string[0] === '#') $hex = substr($string, 1); else $hex = $string; diff --git a/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt b/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt index 08b381d3..c572c14e 100644 --- a/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt +++ b/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt @@ -24,5 +24,6 @@ array ( --DESCRIPTION-- Lookup array of color names to six digit hexadecimal number corresponding -to color, with preceding hash mark. Used when parsing colors. +to color, with preceding hash mark. Used when parsing colors. The lookup +is done in a case-insensitive manner. --# vim: et sw=4 sts=4