mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-08 14:58:42 +00:00
Handle case when IDNAs are supported.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
This commit is contained in:
parent
3ae21ce511
commit
8b28e571fe
@ -38,7 +38,7 @@ class HTMLPurifier_AttrDef_URI_HostTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('f-.top', false);
|
||||
$this->assertDef('1a');
|
||||
|
||||
$this->assertDef("\xE4\xB8\xAD\xE6\x96\x87.com.cn", false);
|
||||
$this->assertDef("\xE4\xB8\xAD\xE6\x96\x87.com.cn", 'xn--fiq228c.com.cn', true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,14 +13,18 @@ class HTMLPurifier_AttrDefHarness extends HTMLPurifier_Harness
|
||||
}
|
||||
|
||||
// cannot be used for accumulator
|
||||
public function assertDef($string, $expect = true)
|
||||
public function assertDef($string, $expect = true, $or_false = false)
|
||||
{
|
||||
// $expect can be a string or bool
|
||||
$result = $this->def->validate($string, $this->config, $this->context);
|
||||
if ($expect === true) {
|
||||
$this->assertIdentical($string, $result);
|
||||
if (!($or_false && $result === false)) {
|
||||
$this->assertIdentical($string, $result);
|
||||
}
|
||||
} else {
|
||||
$this->assertIdentical($expect, $result);
|
||||
if (!($or_false && $result === false)) {
|
||||
$this->assertIdentical($expect, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user