mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-09 23:28:42 +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
|
for more interesting filter-backtracking
|
||||||
. New HTMLPurifier_Injector->rewind() functionality, allows injectors to rewind
|
. New HTMLPurifier_Injector->rewind() functionality, allows injectors to rewind
|
||||||
index to reprocess tokens.
|
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
|
3.1.1, released 2008-06-19
|
||||||
# %URI.Munge now, by default, does not munge resources (for example, <img src="">)
|
# %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) {
|
if (strncmp('--', $line, 2) === 0) {
|
||||||
// Multiline declaration
|
// Multiline declaration
|
||||||
$state = trim($line, '- ');
|
$state = trim($line, '- ');
|
||||||
|
if (!isset($ret[$state])) $ret[$state] = '';
|
||||||
continue;
|
continue;
|
||||||
} elseif (!$state) {
|
} elseif (!$state) {
|
||||||
$single = true;
|
$single = true;
|
||||||
@ -94,7 +95,6 @@ class HTMLPurifier_StringHashParser
|
|||||||
$single = false;
|
$single = false;
|
||||||
$state = false;
|
$state = false;
|
||||||
} else {
|
} else {
|
||||||
if (!isset($ret[$state])) $ret[$state] = '';
|
|
||||||
$ret[$state] .= "$line\n";
|
$ret[$state] .= "$line\n";
|
||||||
}
|
}
|
||||||
} while (!feof($fh));
|
} while (!feof($fh));
|
||||||
|
@ -4,5 +4,6 @@ CHAIN-ME: 2
|
|||||||
--DESCRIPTION--
|
--DESCRIPTION--
|
||||||
Multiline
|
Multiline
|
||||||
stuff
|
stuff
|
||||||
|
--EMPTY--
|
||||||
--FOR-WHO--
|
--FOR-WHO--
|
||||||
Single multiline
|
Single multiline
|
||||||
|
@ -29,6 +29,7 @@ class HTMLPurifier_StringHashParserTest extends UnitTestCase
|
|||||||
'TYPE' => 'string',
|
'TYPE' => 'string',
|
||||||
'CHAIN-ME' => '2',
|
'CHAIN-ME' => '2',
|
||||||
'DESCRIPTION' => "Multiline\nstuff\n",
|
'DESCRIPTION' => "Multiline\nstuff\n",
|
||||||
|
'EMPTY' => '',
|
||||||
'FOR-WHO' => "Single multiline\n",
|
'FOR-WHO' => "Single multiline\n",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user