mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-24 06:11:52 +00:00
[1.6.1] Empty strings get converted to empty arrays instead of arrays with an empty string in them.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1000 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
968dfa2feb
commit
d8a6361244
2
NEWS
2
NEWS
@ -20,6 +20,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
- Possibly fatal bug with __autoload() fixed in module manager
|
- Possibly fatal bug with __autoload() fixed in module manager
|
||||||
- Invert HTMLModuleManager->addModule() processing order to check
|
- Invert HTMLModuleManager->addModule() processing order to check
|
||||||
prefixes first and then the literal module
|
prefixes first and then the literal module
|
||||||
|
- Empty strings get converted to empty arrays instead of arrays with
|
||||||
|
an empty string in them.
|
||||||
. Demo script removed: it has been added to the website's repository
|
. Demo script removed: it has been added to the website's repository
|
||||||
. Basic.php script modified to work out of the box
|
. Basic.php script modified to work out of the box
|
||||||
|
|
||||||
|
@ -334,6 +334,10 @@ class HTMLPurifier_ConfigSchema {
|
|||||||
case 'hash':
|
case 'hash':
|
||||||
case 'lookup':
|
case 'lookup':
|
||||||
if (is_string($var)) {
|
if (is_string($var)) {
|
||||||
|
// special case: technically, this is an array with
|
||||||
|
// a single empty string item, but having an empty
|
||||||
|
// array is more intuitive
|
||||||
|
if ($var == '') return array();
|
||||||
// simplistic string to array method that only works
|
// simplistic string to array method that only works
|
||||||
// for simple lists of tag names or alphanumeric characters
|
// for simple lists of tag names or alphanumeric characters
|
||||||
$var = explode(',',$var);
|
$var = explode(',',$var);
|
||||||
|
@ -277,14 +277,17 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
|
|||||||
|
|
||||||
$this->assertValid(array('1', '2', '3'), 'list');
|
$this->assertValid(array('1', '2', '3'), 'list');
|
||||||
$this->assertValid('foo,bar, cow', 'list', array('foo', 'bar', 'cow'));
|
$this->assertValid('foo,bar, cow', 'list', array('foo', 'bar', 'cow'));
|
||||||
|
$this->assertValid('', 'list', array());
|
||||||
|
|
||||||
$this->assertValid(array('1' => true, '2' => true), 'lookup');
|
$this->assertValid(array('1' => true, '2' => true), 'lookup');
|
||||||
$this->assertValid(array('1', '2'), 'lookup', array('1' => true, '2' => true));
|
$this->assertValid(array('1', '2'), 'lookup', array('1' => true, '2' => true));
|
||||||
$this->assertValid('foo,bar', 'lookup', array('foo' => true, 'bar' => true));
|
$this->assertValid('foo,bar', 'lookup', array('foo' => true, 'bar' => true));
|
||||||
|
$this->assertValid('', 'lookup', array());
|
||||||
|
|
||||||
$this->assertValid(array('foo' => 'bar'), 'hash');
|
$this->assertValid(array('foo' => 'bar'), 'hash');
|
||||||
$this->assertValid(array(1 => 'moo'), 'hash');
|
$this->assertValid(array(1 => 'moo'), 'hash');
|
||||||
$this->assertInvalid(array(0 => 'moo'), 'hash');
|
$this->assertInvalid(array(0 => 'moo'), 'hash');
|
||||||
|
$this->assertValid('', 'hash', array());
|
||||||
|
|
||||||
$this->assertValid(23, 'mixed');
|
$this->assertValid(23, 'mixed');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user