File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1295,7 +1295,11 @@ public function parseRelsAndAlternates() {
12951295 }
12961296
12971297 foreach ($ linkRels as $ rel ) {
1298- $ rels [$ rel ][] = $ href ;
1298+ if (!array_key_exists ($ rel , $ rels )) {
1299+ $ rels [$ rel ] = array ($ href );
1300+ } elseif (!in_array ($ href , $ rels [$ rel ])) {
1301+ $ rels [$ rel ][] = $ href ;
1302+ }
12991303 }
13001304
13011305 if (!array_key_exists ($ href , $ rel_urls )) {
Original file line number Diff line number Diff line change @@ -200,4 +200,13 @@ public function testRelURLsInfoMergesCorrectly() {
200200 $ this ->assertEquals ($ output ['rel-urls ' ]['# ' ]['text ' ], 'This nodeValue ' );
201201 }
202202
203+ public function testRelURLsNoDuplicates () {
204+ $ input = '<a href="#a" rel="a"></a>
205+ <a href="#b" rel="a"></a>
206+ <a href="#a" rel="a"></a> ' ;
207+ $ parser = new Parser ($ input );
208+ $ output = $ parser ->parse ();
209+ $ this ->assertEquals ($ output ['rels ' ]['a ' ], ['#a ' , '#b ' ]);
210+ }
211+
203212}
You can’t perform that action at this time.
0 commit comments