* (bug 10721) Duplicate section anchors with differing case now disambiguated
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 13 Mar 2008 18:30:50 +0000 (18:30 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 13 Mar 2008 18:30:50 +0000 (18:30 +0000)
  for Internet Explorer's sake

RELEASE-NOTES
includes/Parser.php
maintenance/parserTests.txt

index 8100b84..c2888ad 100644 (file)
@@ -81,6 +81,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   case-insensitive names.
 * Adding the fix for lists in RTL wikis to more skins, and fixing the image toc
 * (bug 8157) Remove redirects from Special:Unusedtemplates. Patch by WebBoy.
+* (bug 10721) Duplicate section anchors with differing case now disambiguated
+  for Internet Explorer's sake
+
 
 === API changes in 1.13 ===
 
index acefb8d..ef4e2a1 100644 (file)
@@ -3494,11 +3494,16 @@ class Parser
                        # Save headline for section edit hint before it's escaped
                        $headlineHint = $safeHeadline;
                        $safeHeadline = Sanitizer::escapeId( $safeHeadline );
+                       # lowercase headline, since some browser don't distinguish
+                       # "Anchor" from "anchor" (bug #10721)
+                       $arrayKey = strtolower( $safeHeadline );
+
+                       # XXX : Is $refers[$headlineCount] ever accessed, actually ?
                        $refers[$headlineCount] = $safeHeadline;
 
                        # count how many in assoc. array so we can track dupes in anchors
-                       isset( $refers[$safeHeadline] ) ? $refers[$safeHeadline]++ : $refers[$safeHeadline] = 1;
-                       $refcount[$headlineCount] = $refers[$safeHeadline];
+                       isset( $refers[$arrayKey] ) ? $refers[$arrayKey]++ : $refers[$arrayKey] = 1;
+                       $refcount[$headlineCount] = $refers[$arrayKey];
 
                        # Don't number the heading if it is the only one (looks silly)
                        if( $doNumberHeadings && count( $matches[3] ) > 1) {
index fb9708a..2e72415 100644 (file)
@@ -3551,6 +3551,17 @@ Resolving duplicate section names
 
 !! end
 
+!! test
+Resolving duplicate section names with differing case (bug 10721)
+!! input
+== Foo bar ==
+== Foo Bar ==
+!! result
+<a name="Foo_bar"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
+<a name="Foo_Bar_2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline"> Foo Bar </span></h2>
+
+!! end
+
 !! article
 Template:sections
 !! text