Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Io/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ public function loadXmlString($html)
// fix invalid markup of outdated ViewVC versions
// - help link in footer not terminated
// - selected branch/tag in CVS "sticky tag" dropdown has not attribute value
// - clear button for selected branch/tag has no trailing slash
// - self closing elements with no trailing slash
// - excessive form close tags
$html = str_replace('Help</strong></td>', 'Help</a></strong></td>', $html);
$html = str_replace('selected>', 'selected="selected">', $html);
$html = preg_replace('#<input([^\/]+)>#', '<input$1 />', $html);
$html = preg_replace('#<((?:input|br|hr|img)[^\/\>]*)>#', '<$1 />', $html);
$html = preg_replace('#(</table>\s*)</form>\s*(</div>)#', '$1$2', $html);

// replace named HTML entities with their UTF-8 value
$html = str_replace(array_values($this->entities), array_keys($this->entities), $html);
Expand Down
6 changes: 6 additions & 0 deletions tests/Io/LoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public function testLoadInvalidMarkupInputNotClosed()
$this->assertEquals('hidden', (string)$xml['type']);
}

public function testPrepareInvalidMarkupBrNotClosed()
{
$html = '<br>';
$xml = $this->loader->loadXmlString($html);
}

public function testLoadInvalidMarkupSelectedAttributeNoValue()
{
$str = '<option selected>this</option>';
Expand Down