mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 05:11:52 +00:00
[2.1.3] Fatal error when <img> tag (or any other element with required attributes) has 'id' attribute fixed, thanks NykO18 for reporting
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1420 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
5f76796e14
commit
ca43df9fdd
2
NEWS
2
NEWS
@ -15,6 +15,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
- Injector algorithm further refined: off-by-one error regarding skip
|
- Injector algorithm further refined: off-by-one error regarding skip
|
||||||
counts for dormant injectors fixed
|
counts for dormant injectors fixed
|
||||||
- Corrective blockquote definition now enabled for HTML 4.01 Strict
|
- Corrective blockquote definition now enabled for HTML 4.01 Strict
|
||||||
|
- Fatal error when <img> tag (or any other element with required attributes)
|
||||||
|
has 'id' attribute fixed, thanks NykO18 for reporting
|
||||||
. %Core.AcceptFullDocuments renamed to %Core.ConvertDocumentToFragment
|
. %Core.AcceptFullDocuments renamed to %Core.ConvertDocumentToFragment
|
||||||
to better communicate its purpose
|
to better communicate its purpose
|
||||||
|
|
||||||
|
@ -157,6 +157,12 @@ class HTMLPurifier
|
|||||||
$context->register('ErrorCollector', $error_collector);
|
$context->register('ErrorCollector', $error_collector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup id_accumulator context, necessary due to the fact that
|
||||||
|
// AttrValidator can be called from many places
|
||||||
|
$id_accumulator = new HTMLPurifier_IDAccumulator();
|
||||||
|
$id_accumulator->load($config->get('Attr', 'IDBlacklist'));
|
||||||
|
$context->register('IDAccumulator', $id_accumulator);
|
||||||
|
|
||||||
$html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context);
|
$html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context);
|
||||||
|
|
||||||
for ($i = 0, $size = count($this->filters); $i < $size; $i++) {
|
for ($i = 0, $size = count($this->filters); $i < $size; $i++) {
|
||||||
|
@ -19,11 +19,6 @@ class HTMLPurifier_Strategy_ValidateAttributes extends HTMLPurifier_Strategy
|
|||||||
|
|
||||||
function execute($tokens, $config, &$context) {
|
function execute($tokens, $config, &$context) {
|
||||||
|
|
||||||
// setup id_accumulator context
|
|
||||||
$id_accumulator = new HTMLPurifier_IDAccumulator();
|
|
||||||
$id_accumulator->load($config->get('Attr', 'IDBlacklist'));
|
|
||||||
$context->register('IDAccumulator', $id_accumulator);
|
|
||||||
|
|
||||||
// setup validator
|
// setup validator
|
||||||
$validator = new HTMLPurifier_AttrValidator();
|
$validator = new HTMLPurifier_AttrValidator();
|
||||||
|
|
||||||
@ -44,8 +39,6 @@ class HTMLPurifier_Strategy_ValidateAttributes extends HTMLPurifier_Strategy
|
|||||||
|
|
||||||
$tokens[$key] = $token; // for PHP 4
|
$tokens[$key] = $token; // for PHP 4
|
||||||
}
|
}
|
||||||
|
|
||||||
$context->destroy('IDAccumulator');
|
|
||||||
$context->destroy('CurrentToken');
|
$context->destroy('CurrentToken');
|
||||||
|
|
||||||
return $tokens;
|
return $tokens;
|
||||||
|
Loading…
Reference in New Issue
Block a user