File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,13 @@ public function loadXmlFile($path)
26
26
27
27
public function loadXmlString ($ html )
28
28
{
29
- // fix invalid markup of help link in footer of outdated ViewVC versions
29
+ // fix invalid markup of outdated ViewVC versions
30
+ // - help link in footer not terminated
31
+ // - selected branch/tag in CVS "sticky tag" dropdown has not attribute value
32
+ // - clear button for selected branch/tag has no trailing slash
30
33
$ html = str_replace ('Help</strong></td> ' , 'Help</a></strong></td> ' , $ html );
34
+ $ html = str_replace ('selected> ' , 'selected="selected"> ' , $ html );
35
+ $ html = preg_replace ('#<input([^\/]+)># ' , '<input$1 /> ' , $ html );
31
36
32
37
// replace named HTML entities with their UTF-8 value
33
38
$ html = str_replace (array_values ($ this ->entities ), array_keys ($ this ->entities ), $ html );
Original file line number Diff line number Diff line change @@ -38,4 +38,20 @@ public function testHtmlEntities()
38
38
// c3 a4 e2 80 a6 c2 a0 c2 a9
39
39
$ this ->assertEquals ('ä… © ' , (string )$ xml );
40
40
}
41
+
42
+ public function testLoadInvalidMarkupInputNotClosed ()
43
+ {
44
+ $ str = '<input type="hidden"> ' ;
45
+ $ xml = $ this ->loader ->loadXmlString ($ str );
46
+
47
+ $ this ->assertEquals ('hidden ' , (string )$ xml ['type ' ]);
48
+ }
49
+
50
+ public function testLoadInvalidMarkupSelectedAttributeNoValue ()
51
+ {
52
+ $ str = '<option selected>this</option> ' ;
53
+ $ xml = $ this ->loader ->loadXmlString ($ str );
54
+
55
+ $ this ->assertEquals ('selected ' , (string )$ xml ['selected ' ]);
56
+ }
41
57
}
You can’t perform that action at this time.
0 commit comments