diff options
author | Aleksander Machniak <alec@alec.pl> | 2019-04-14 10:53:02 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2019-04-14 10:53:02 +0300 |
commit | 03d56926d81da1edaf73aa8a783bd01be7922abc (patch) | |
tree | 9362b7bc0fb40ef9421830fd46e3304fed25d754 /tests | |
parent | 1078d8df162afb9099bd401ddebc3ce92f33cdde (diff) |
Fix bug in HTML parser that could cause missing text fragments when there was no head/body tag (#6713)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Framework/Washtml.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php index 1dbb87a93..bbccd8d6d 100644 --- a/tests/Framework/Washtml.php +++ b/tests/Framework/Washtml.php @@ -444,4 +444,32 @@ class Framework_Washtml extends PHPUnit_Framework_TestCase $this->assertNotContains('<?xml:namespace"', $washed); $this->assertSame($washed, '<p></p>'); } + + /** + * Test missing main HTML hierarchy tags (#6713) + */ + function test_missing_tags() + { + $washer = new rcube_washtml(); + + $html = '<head></head>First line<br />Second line'; + $washed = $washer->wash($html); + + $this->assertContains('First line', $washed); + + $html = 'First line<br />Second line'; + $washed = $washer->wash($html); + + $this->assertContains('First line', $washed); + + $html = '<html>First line<br />Second line</html>'; + $washed = $washer->wash($html); + + $this->assertContains('First line', $washed); + + $html = '<html><head></head>First line<br />Second line</html>'; + $washed = $washer->wash($html); + + $this->assertContains('First line', $washed); + } } |