0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 08:21:52 +00:00

Make purifyArray work with empty array (#245)

This commit is contained in:
Fräntz Miccoli 2020-02-22 18:12:02 +01:00 committed by GitHub
parent c2c91f52d0
commit ced089434d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -240,6 +240,7 @@ class HTMLPurifier
public function purifyArray($array_of_html, $config = null)
{
$context_array = array();
$array = array();
foreach($array_of_html as $key=>$value){
if (is_array($value)) {
$array[$key] = $this->purifyArray($value, $config);

View File

@ -32,6 +32,13 @@ class HTMLPurifierTest extends HTMLPurifier_Harness
);
}
public function test_purifyArray_empty() {
$purifiedEmptyArray = $this->purifier->purifyArray(array());
$this->assertTrue(
empty($purifiedEmptyArray)
);
}
public function testGetInstance()
{
$purifier = HTMLPurifier::getInstance();