diff --git a/NEWS b/NEWS index 4ef5ab25..57ce8ec8 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier ! Added enduser-youtube.html, explains how to embed YouTube videos. See also corresponding smoketest preserveYouTube.php. ! Added purifyArray(), which takes a list of HTML and purifies it all +- Fixed fatal error thrown by upper-cased language attributes - printDefinition.php: added labels, added better clarification . HTMLPurifier_Config::create() added, takes mixed variable and converts into a HTMLPurifier_Config object. diff --git a/library/HTMLPurifier/AttrDef/Lang.php b/library/HTMLPurifier/AttrDef/Lang.php index 58809c2b..67183747 100644 --- a/library/HTMLPurifier/AttrDef/Lang.php +++ b/library/HTMLPurifier/AttrDef/Lang.php @@ -49,7 +49,7 @@ class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef if ($length == 0 || $length == 1 || $length > 8 || !ctype_alnum($subtags[1])) { return $new_string; } - if (!ctype_lower($subtags[1])) $subtags[1] = strotolower($subtags[1]); + if (!ctype_lower($subtags[1])) $subtags[1] = strtolower($subtags[1]); $new_string .= '-' . $subtags[1]; if ($num_subtags == 2) return $new_string; @@ -61,7 +61,7 @@ class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef return $new_string; } if (!ctype_lower($subtags[$i])) { - $subtags[$i] = strotolower($subtags[$i]); + $subtags[$i] = strtolower($subtags[$i]); } $new_string .= '-' . $subtags[$i]; } diff --git a/tests/HTMLPurifier/AttrDef/LangTest.php b/tests/HTMLPurifier/AttrDef/LangTest.php index 216a7a88..7a0e4308 100644 --- a/tests/HTMLPurifier/AttrDef/LangTest.php +++ b/tests/HTMLPurifier/AttrDef/LangTest.php @@ -17,6 +17,9 @@ class HTMLPurifier_AttrDef_LangTest extends HTMLPurifier_AttrDefHarness $this->assertDef(' en ', 'en'); // trim $this->assertDef('EN', 'en'); // case insensitivity + // (thanks Eugen Pankratz for noticing the typos!) + $this->assertDef('En-Us-Edison', 'en-us-edison'); // complex ci + $this->assertDef('fr en', false); // multiple languages $this->assertDef('%', false); // bad character @@ -26,7 +29,7 @@ class HTMLPurifier_AttrDef_LangTest extends HTMLPurifier_AttrDefHarness // primary subtag rules // I'm somewhat hesitant to allow x and i as primary language codes, // because they usually are never used in real life. However, - // theoretically speaking, having them alone is permissble, so + // theoretically speaking, having them alone is permissable, so // I'll be lenient. No XML parser is going to complain anyway. $this->assertDef('x'); $this->assertDef('i');