mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-18 11:41:52 +00:00
Allow empty sections in string hashes; previously they were left undefined.
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
parent
aa0fdeee30
commit
a227cb483a
2
NEWS
2
NEWS
@ -31,6 +31,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
||||
for more interesting filter-backtracking
|
||||
. New HTMLPurifier_Injector->rewind() functionality, allows injectors to rewind
|
||||
index to reprocess tokens.
|
||||
. StringHashParser now allows for multiline sections with "empty" content;
|
||||
previously the section would remain undefined.
|
||||
|
||||
3.1.1, released 2008-06-19
|
||||
# %URI.Munge now, by default, does not munge resources (for example, <img src="">)
|
||||
|
@ -78,6 +78,7 @@ class HTMLPurifier_StringHashParser
|
||||
if (strncmp('--', $line, 2) === 0) {
|
||||
// Multiline declaration
|
||||
$state = trim($line, '- ');
|
||||
if (!isset($ret[$state])) $ret[$state] = '';
|
||||
continue;
|
||||
} elseif (!$state) {
|
||||
$single = true;
|
||||
@ -94,7 +95,6 @@ class HTMLPurifier_StringHashParser
|
||||
$single = false;
|
||||
$state = false;
|
||||
} else {
|
||||
if (!isset($ret[$state])) $ret[$state] = '';
|
||||
$ret[$state] .= "$line\n";
|
||||
}
|
||||
} while (!feof($fh));
|
||||
|
@ -4,5 +4,6 @@ CHAIN-ME: 2
|
||||
--DESCRIPTION--
|
||||
Multiline
|
||||
stuff
|
||||
--EMPTY--
|
||||
--FOR-WHO--
|
||||
Single multiline
|
||||
|
@ -29,6 +29,7 @@ class HTMLPurifier_StringHashParserTest extends UnitTestCase
|
||||
'TYPE' => 'string',
|
||||
'CHAIN-ME' => '2',
|
||||
'DESCRIPTION' => "Multiline\nstuff\n",
|
||||
'EMPTY' => '',
|
||||
'FOR-WHO' => "Single multiline\n",
|
||||
));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user