mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 05:37:49 +02:00
Fix chameleon behavior with ins and del.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@145 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -47,12 +47,27 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
|
||||
// $i is index of start token
|
||||
// $j is index of end token
|
||||
|
||||
// calculate parent information
|
||||
if ($count = count($stack)) {
|
||||
$parent_index = $stack[$count-1];
|
||||
$parent_name = $tokens[$parent_index]->name;
|
||||
$parent_def = $this->definition->info[$parent_name];
|
||||
} else {
|
||||
$parent_index = $parent_name = $parent_def = null;
|
||||
}
|
||||
|
||||
// calculate context
|
||||
if (isset($parent_def)) {
|
||||
$context = $parent_def->type;
|
||||
} else {
|
||||
$context = 'unknown';
|
||||
}
|
||||
|
||||
// DEFINITION CALL
|
||||
$child_def = $this->definition->info[$tokens[$i]->name]->child;
|
||||
|
||||
// have DTD child def validate children
|
||||
$result = $child_def->validateChildren($child_tokens);
|
||||
$result = $child_def->validateChildren($child_tokens, $context);
|
||||
|
||||
// process result
|
||||
if ($result === true) {
|
||||
@@ -79,10 +94,6 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
|
||||
// current node is now the next possible start node
|
||||
// unless it turns out that we need to do a double-check
|
||||
|
||||
$parent_index = $stack[count($stack)-1];
|
||||
$parent_name = $tokens[$parent_index]->name;
|
||||
$parent_def = $this->definition->info[$parent_name];
|
||||
|
||||
if (!$parent_def->child->allow_empty) {
|
||||
// we need to do a double-check
|
||||
$i = $parent_index;
|
||||
|
Reference in New Issue
Block a user