0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-03-23 14:27:02 +00:00

All values, including empty, are valid HTML bools.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
This commit is contained in:
Edward Z. Yang 2015-02-11 16:36:44 -08:00
parent 0c3e68dd03
commit c67e4c2f7e
3 changed files with 3 additions and 4 deletions

2
NEWS
View File

@ -22,6 +22,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
- Update YouTube filter for new code. - Update YouTube filter for new code.
- Fix parsing of rgb() values with spaces in them for 'border' - Fix parsing of rgb() values with spaces in them for 'border'
attribute. attribute.
- Don't remove foo="" attributes if foo is a boolean attribute. Thanks
valME for reporting.
4.6.0, released 2013-11-30 4.6.0, released 2013-11-30
# Secure URI munge hashing algorithm has changed to hash_hmac("sha256", $url, $secret). # Secure URI munge hashing algorithm has changed to hash_hmac("sha256", $url, $secret).

View File

@ -32,9 +32,6 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
*/ */
public function validate($string, $config, $context) public function validate($string, $config, $context)
{ {
if (empty($string)) {
return false;
}
return $this->name; return $this->name;
} }

View File

@ -7,7 +7,7 @@ class HTMLPurifier_AttrDef_HTML_BoolTest extends HTMLPurifier_AttrDefHarness
{ {
$this->def = new HTMLPurifier_AttrDef_HTML_Bool('foo'); $this->def = new HTMLPurifier_AttrDef_HTML_Bool('foo');
$this->assertDef('foo'); $this->assertDef('foo');
$this->assertDef('', false); $this->assertDef('', 'foo');
$this->assertDef('bar', 'foo'); $this->assertDef('bar', 'foo');
} }