mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-03 12:47:56 +02:00
Fixed rejection of case-insensitive configuration values when there is a set of allowed values. This manifested in %Core.Encoding.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@367 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
2
NEWS
2
NEWS
@@ -3,6 +3,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
|
|
||||||
1.0.1, unknown release date
|
1.0.1, unknown release date
|
||||||
- Fixed slight bug in DOMLex attribute parsing
|
- Fixed slight bug in DOMLex attribute parsing
|
||||||
|
- Fixed rejection of case-insensitive configuration values when there is a
|
||||||
|
set of allowed values. This manifested in %Core.Encoding.
|
||||||
|
|
||||||
1.0.0, released 2006-09-01
|
1.0.0, released 2006-09-01
|
||||||
- Fixed broken numeric entity conversion
|
- Fixed broken numeric entity conversion
|
||||||
|
@@ -80,6 +80,8 @@ class HTMLPurifier_Config
|
|||||||
E_USER_WARNING);
|
E_USER_WARNING);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$value = $this->def->validate($value,
|
||||||
|
$this->def->info[$namespace][$key]->type);
|
||||||
if (is_string($value)) {
|
if (is_string($value)) {
|
||||||
// resolve value alias if defined
|
// resolve value alias if defined
|
||||||
if (isset($this->def->info[$namespace][$key]->aliases[$value])) {
|
if (isset($this->def->info[$namespace][$key]->aliases[$value])) {
|
||||||
@@ -93,8 +95,6 @@ class HTMLPurifier_Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$value = $this->def->validate($value,
|
|
||||||
$this->def->info[$namespace][$key]->type);
|
|
||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
trigger_error('Value is of invalid type', E_USER_WARNING);
|
trigger_error('Value is of invalid type', E_USER_WARNING);
|
||||||
return;
|
return;
|
||||||
|
@@ -23,6 +23,11 @@ if ( !function_exists('iconv') ) {
|
|||||||
'iso-8859-1'
|
'iso-8859-1'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
HTMLPurifier_ConfigDef::defineValueAliases(
|
||||||
|
'Core', 'Encoding', array(
|
||||||
|
'iso8859-1' => 'iso-8859-1'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -32,6 +32,9 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
|
|||||||
HTMLPurifier_ConfigDef::define(
|
HTMLPurifier_ConfigDef::define(
|
||||||
'Extension', 'Pert', 'foo', 'string', 'A string directive.'
|
'Extension', 'Pert', 'foo', 'string', 'A string directive.'
|
||||||
);
|
);
|
||||||
|
HTMLPurifier_ConfigDef::define(
|
||||||
|
'Core', 'Encoding', 'utf-8', 'istring', 'Case insensitivity!'
|
||||||
|
);
|
||||||
|
|
||||||
HTMLPurifier_ConfigDef::defineAllowedValues(
|
HTMLPurifier_ConfigDef::defineAllowedValues(
|
||||||
'Extension', 'Pert', array('foo', 'moo')
|
'Extension', 'Pert', array('foo', 'moo')
|
||||||
@@ -39,6 +42,9 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
|
|||||||
HTMLPurifier_ConfigDef::defineValueAliases(
|
HTMLPurifier_ConfigDef::defineValueAliases(
|
||||||
'Extension', 'Pert', array('cow' => 'moo')
|
'Extension', 'Pert', array('cow' => 'moo')
|
||||||
);
|
);
|
||||||
|
HTMLPurifier_ConfigDef::defineAllowedValues(
|
||||||
|
'Core', 'Encoding', array('utf-8', 'iso-8859-1')
|
||||||
|
);
|
||||||
|
|
||||||
$config = HTMLPurifier_Config::createDefault();
|
$config = HTMLPurifier_Config::createDefault();
|
||||||
|
|
||||||
@@ -80,6 +86,11 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
|
|||||||
$this->assertNoErrors();
|
$this->assertNoErrors();
|
||||||
$this->assertIdentical($config->get('Extension', 'Pert'), 'moo');
|
$this->assertIdentical($config->get('Extension', 'Pert'), 'moo');
|
||||||
|
|
||||||
|
// case-insensitive attempt to set value that is allowed
|
||||||
|
$config->set('Core', 'Encoding', 'ISO-8859-1');
|
||||||
|
$this->assertNoErrors();
|
||||||
|
$this->assertIdentical($config->get('Core', 'Encoding'), 'iso-8859-1');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user