0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-23 00:41:52 +00:00

Fix allowsElement() bug manifesting in LinkifyTest.

Thanks frank farmer for reporting.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang 2009-06-10 18:11:34 -04:00
parent e8abd5953c
commit 733a5ce5c3
2 changed files with 10 additions and 0 deletions

View File

@ -137,6 +137,12 @@ abstract class HTMLPurifier_Injector
if (!isset($parent->child->elements[$name]) || isset($parent->excludes[$name])) { if (!isset($parent->child->elements[$name]) || isset($parent->excludes[$name])) {
return false; return false;
} }
// check for exclusion
for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
$node = $this->currentNesting[$i];
$def = $this->htmlDefinition->info[$node->name];
if (isset($def->excludes[$name])) return false;
}
return true; return true;
} }

View File

@ -41,6 +41,10 @@ class HTMLPurifier_Injector_LinkifyTest extends HTMLPurifier_InjectorHarness
$this->assertResult('http://example.com/'); $this->assertResult('http://example.com/');
} }
function testExcludes() {
$this->assertResult('<a><span>http://example.com</span></a>');
}
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4