diff --git a/includes/ImageMap.php b/includes/ImageMap.php index 6fc24eb..d67f20e 100644 --- a/includes/ImageMap.php +++ b/includes/ImageMap.php @@ -279,9 +279,11 @@ class ImageMap { if ( $realmap ) { // Construct the map - // Add random number to avoid breaking cached HTML fragments that are - // later joined together on the one page (bug 16471) - $mapName = "ImageMap_" . ++self::$id . '_' . mt_rand( 0, 0x7fffffff ); + // Add a hash of the map HTML to avoid breaking cached HTML fragments that are + // later joined together on the one page (T18471). + // The only way these hashes can clash is if the map is identical, in which + // case it wouldn't matter that the "wrong" map was used. + $mapName = 'ImageMap_' . substr( md5( $mapHTML ), 0, 16 ); $mapHTML = "\n"; // Alter the image tag diff --git a/tests/parser/imageMapParserTests.txt b/tests/parser/imageMapParserTests.txt index 70357ef..ef677e1 100644 --- a/tests/parser/imageMapParserTests.txt +++ b/tests/parser/imageMapParserTests.txt @@ -7,3 +7,15 @@ Image:Foobar.jpg !! result
!! end + +!! test +dummy test +!! input +