diff --git a/library/HTMLPurifier.php b/library/HTMLPurifier.php
index 58bbddb0..10e61c14 100644
--- a/library/HTMLPurifier.php
+++ b/library/HTMLPurifier.php
@@ -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);
diff --git a/tests/HTMLPurifierTest.php b/tests/HTMLPurifierTest.php
index 2d28bc3c..a51038eb 100644
--- a/tests/HTMLPurifierTest.php
+++ b/tests/HTMLPurifierTest.php
@@ -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();