Page MenuHomePhabricator

ImageMap Thumbnail Creates "everything linked" view in Templates and Categories
Closed, ResolvedPublic

Description

I am using the {{tag#imagemap}} syntax within a template as shown in the Extension:ImageMap article on MediaWiki.org, as shown in the following:
http://jorgie.us/index.php?title=Template:Project_Management_Diagram

However, as you will notice, the <noinclude> text is completely hyperlinked. When I remove the "thumb" configuration, the hyperlink goes away.

When I embedded this template within a category page, as in the following, all the text in the Category page is also treated like a hyperlink (none of it should).
http://jorgie.us/index.php?title=Category:Project_Management

Though when I use the template on a mainspace page, I'm not seeing the problem, as shown here (though I an using a <div> command:
http://jorgie.us/index.php?title=Plan_Project

And then on this page, the words "Here is a" is hyperlinked with the diagram:
http://jorgie.us/index.php?title=Engineering_Design_and_Development

when it should not be. Some quirky behavior when you use the "thumb" setting of an imagemap with the #tag.

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 2 2016, 5:48 PM

I just upgraded to 1.27 and I had the same problem. Here is the fix:

ImageMap_body.php
Line 354, change to:
$output = preg_replace( '/<\?xml[^?]*\?>/', '', $domDoc->saveXML(NULL, LIBXML_NOEMPTYTAG) );

Kghbln triaged this task as High priority.Sep 28 2017, 8:37 AM
Kghbln added a subscriber: Kghbln.Sep 28 2017, 8:41 AM

I believe that this is a rather serious issue also affecting WMF wikis as well as the following example shows. The link event continues on into the following text no matter what, e.g. pre etc. until you have some [[wikilink]]. The exentsion's page also shows the issue.

For this reason I triaged with high. Perhaps it is just a matter of moving in the code suggested. Attention to this will be greatly appreciated.

Change 383548 had a related patch set uploaded (by Kghbln; owner: Karsten Hoffmeyer):
[mediawiki/extensions/ImageMap@master] Fixes critical bug causing endless links

https://gerrit.wikimedia.org/r/383548

Change 383548 merged by jenkins-bot:
[mediawiki/extensions/ImageMap@master] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/383548

Change 384643 had a related patch set uploaded (by Legoktm; owner: Karsten Hoffmeyer):
[mediawiki/extensions/ImageMap@REL1_30] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/384643

Change 384643 merged by jenkins-bot:
[mediawiki/extensions/ImageMap@REL1_30] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/384643

Legoktm added subscribers: demon, Legoktm.

OK, I've merged and backported this into master and REL1_30, opinions on REL1_28 and REL1_27? Since this affects only wikis without tidy, it would impact most vanilla MediaWiki installs if they also installed ImageMap (bundled in tarball).

It will be great to get a fix at least for the MW 1.27 LTS branch.

@Legoktm I did not really understand you comment as to which sort of wiki will get help from the fix. As the example shows things are still utterly broken on mw.o though the latest version of ImageMap was deployed.

It just required a null edit - https://www.mediawiki.org/wiki/User:Kghbln/imagemap displays properly now for me.

Change 385325 had a related patch set uploaded (by Legoktm; owner: Karsten Hoffmeyer):
[mediawiki/extensions/ImageMap@REL1_28] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/385325

Change 385326 had a related patch set uploaded (by Legoktm; owner: Karsten Hoffmeyer):
[mediawiki/extensions/ImageMap@REL1_27] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/385326

Change 385327 had a related patch set uploaded (by Legoktm; owner: Karsten Hoffmeyer):
[mediawiki/extensions/ImageMap@REL1_29] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/385327

It just required a null edit - https://www.mediawiki.org/wiki/User:Kghbln/imagemap displays properly now for me.

Affirmative, I should have come up with this too. Caching is extreme those days. :)

Thanks also for fluffing the other branches!

Change 385327 merged by jenkins-bot:
[mediawiki/extensions/ImageMap@REL1_29] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/385327

Umherirrender closed this task as Resolved.Oct 20 2017, 2:24 PM

Change 385325 merged by jenkins-bot:
[mediawiki/extensions/ImageMap@REL1_28] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/385325

Change 385326 merged by jenkins-bot:
[mediawiki/extensions/ImageMap@REL1_27] Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag

https://gerrit.wikimedia.org/r/385326