From 4fd26b6b8a0179bce93168d519041428532314a6 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 1 Nov 2008 22:30:56 +0000 Subject: [PATCH] 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. :) --- includes/GlobalFunctions.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index e7792a3525..616c7a7e2a 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2320,13 +2320,16 @@ function wfRelativePath( $path, $from ) { } /** - * array_merge() does awful things with "numeric" indexes, including - * string indexes when happen to look like integers. When we want - * to merge arrays with arbitrary string indexes, we don't want our - * arrays to be randomly corrupted just because some of them consist - * of numbers. + * Like array_merge(), but always applying the behavior for string + * keys. array_merge() has inconsistent behavior when your string + * indexes happen to look like integers, which is undesireable + * for arbitrary input. * - * Fuck you, PHP. Fuck you in the ear! + * This is roughly equivalent to $array1 + $array2 + $array3... + * but has different behavior when there are conflicts. + * + * array_merge() and wfArrayMerge() take the right-hand value, + * whereas the + operator takes the left-hand value. * * @param array $array1, [$array2, [...]] * @return array -- 2.20.1