r36248 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36247‎ | r36248 | r36249 >
Date:22:06, 12 June 2008
Author:simetrical
Status:old
Tags:
Comment:
Another PHP weak typing bug: when section anchors are numeric, the string indexes in the $refers array overwrite the numeric indexes, causing it to seem like there are already references with the same name, so extra numbers are added to the end. Reported at: <http://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&amp;diff=218878862&amp;oldid=218873693&gt;
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3570,9 +3570,6 @@
35713571 # HTML names must be case-insensitively unique (bug 10721)
35723572 $arrayKey = strtolower( $safeHeadline );
35733573
3574 - # XXX : Is $refers[$headlineCount] ever accessed, actually ?
3575 - $refers[$headlineCount] = $safeHeadline;
3576 -
35773574 # count how many in assoc. array so we can track dupes in anchors
35783575 isset( $refers[$arrayKey] ) ? $refers[$arrayKey]++ : $refers[$arrayKey] = 1;
35793576 $refcount[$headlineCount] = $refers[$arrayKey];
Index: trunk/phase3/RELEASE-NOTES
@@ -368,6 +368,7 @@
369369 * (bug 14500) Site feed (Recentchanges) no longer shows up on the actual
370370 recent changes page.
371371 * (bug 14511) MediaWiki:Delete-legend is no longer double escaped
 372+* Generate correct section anchors for numeric headers
372373
373374 === API changes in 1.13 ===
374375

Follow-up revisions

RevisionCommit summaryAuthorDate
r36470Update parser test case for fixes in r36248brion17:19, 19 June 2008

Status & tagging log