r43041 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43040‎ | r43041 | r43042 >
Date:22:30, 1 November 2008
Author:brion
Status:old
Tags:
Comment:
Update doc comment for wfArrayMerge() to note the behavior difference between array_merge() with string keys and the + operator on arrays. Now with less cursing. :)
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2320,14 +2320,17 @@
23212321 }
23222322
23232323 /**
2324 - * array_merge() does awful things with "numeric" indexes, including
2325 - * string indexes when happen to look like integers. When we want
2326 - * to merge arrays with arbitrary string indexes, we don't want our
2327 - * arrays to be randomly corrupted just because some of them consist
2328 - * of numbers.
 2324+ * Like array_merge(), but always applying the behavior for string
 2325+ * keys. array_merge() has inconsistent behavior when your string
 2326+ * indexes happen to look like integers, which is undesireable
 2327+ * for arbitrary input.
23292328 *
2330 - * Fuck you, PHP. Fuck you in the ear!
 2329+ * This is roughly equivalent to $array1 + $array2 + $array3...
 2330+ * but has different behavior when there are conflicts.
23312331 *
 2332+ * array_merge() and wfArrayMerge() take the right-hand value,
 2333+ * whereas the + operator takes the left-hand value.
 2334+ *
23322335 * @param array $array1, [$array2, [...]]
23332336 * @return array
23342337 */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r31327* (bug 13139, 13074) Fix request data for parameters with numeric namesbrion22:33, 26 February 2008

Status & tagging log