Merge branch 'wash-xml-namespace' of https://github.com/dsoares/roundcubemail into dsoares-wash-xml-namespace

pull/6724/head
Aleksander Machniak 6 years ago
commit 6f479096d5

@ -605,6 +605,8 @@ class rcube_washtml
'/^(\0\0\xFE\xFF|\xFF\xFE\0\0|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/',
// washtml/DOMDocument cannot handle xml namespaces
'/<html\s[^>]+>/i',
// washtml/DOMDocument cannot handle xml namespaces
'/<\?xml:namespace\s[^>]+>/i',
);
$html_replace = array(
@ -613,6 +615,7 @@ class rcube_washtml
'',
'',
'<html>',
'',
);
$html = preg_replace($html_search, $html_replace, $html);

@ -430,4 +430,18 @@ class Framework_Washtml extends PHPUnit_Framework_TestCase
$this->assertContains('for="testmy-other-id"', $washed);
$this->assertContains('class="testmy-class1 testmy-class2"', $washed);
}
/**
* Test removing xml:namespace tag
*/
function test_xml_namespace()
{
$html = '<p><?xml:namespace prefix = "xsl" /></p>';
$washer = new rcube_washtml;
$washed = $this->cleanupResult($washer->wash($html));
$this->assertNotContains('&lt;?xml:namespace"', $washed);
$this->assertSame($washed, '<p></p>');
}
}

Loading…
Cancel
Save