File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,12 @@ public function loadXmlString($html)
29
29
// fix invalid markup of outdated ViewVC versions
30
30
// - help link in footer not terminated
31
31
// - selected branch/tag in CVS "sticky tag" dropdown has not attribute value
32
- // - clear button for selected branch/tag has no trailing slash
32
+ // - self closing elements with no trailing slash
33
+ // - excessive form close tags
33
34
$ html = str_replace ('Help</strong></td> ' , 'Help</a></strong></td> ' , $ html );
34
35
$ html = str_replace ('selected> ' , 'selected="selected"> ' , $ html );
35
- $ html = preg_replace ('#<input([^\/]+)># ' , '<input$1 /> ' , $ html );
36
+ $ html = preg_replace ('#<((?:input|br|hr|img)[^\/\>]*)># ' , '<$1 /> ' , $ html );
37
+ $ html = preg_replace ('#(</table>\s*)</form>\s*(</div>)# ' , '$1$2 ' , $ html );
36
38
37
39
// replace named HTML entities with their UTF-8 value
38
40
$ html = str_replace (array_values ($ this ->entities ), array_keys ($ this ->entities ), $ html );
Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ public function testLoadInvalidMarkupInputNotClosed()
47
47
$ this ->assertEquals ('hidden ' , (string )$ xml ['type ' ]);
48
48
}
49
49
50
+ public function testPrepareInvalidMarkupBrNotClosed ()
51
+ {
52
+ $ html = '<br> ' ;
53
+ $ xml = $ this ->loader ->loadXmlString ($ html );
54
+ }
55
+
50
56
public function testLoadInvalidMarkupSelectedAttributeNoValue ()
51
57
{
52
58
$ str = '<option selected>this</option> ' ;
You can’t perform that action at this time.
0 commit comments