From: Reedy Date: Fri, 27 Sep 2013 19:10:33 +0000 (+0100) Subject: In wfArrayDiff2_cmp only compare $a and $b as string if they both are strings X-Git-Tag: 1.31.0-rc.0~18663^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=994bf115a78e5202612359066c5c1636a7df0d9b;p=lhc%2Fweb%2Fwiklou.git In wfArrayDiff2_cmp only compare $a and $b as string if they both are strings Noticed during bug 54662 Warning: strcmp() expects parameter 2 to be string, array given in /usr/local/apache/common-local/php-1.22wmf19/includes/GlobalFunctions.php on line 127 Bug: 54662 Change-Id: Icdd7fa229e49d7e83aa2a7992895f497806448e1 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 414c8222f2..ee88ac0251 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -118,12 +118,12 @@ function wfArrayDiff2( $a, $b ) { } /** - * @param $a - * @param $b + * @param $a array|string + * @param $b array|string * @return int */ function wfArrayDiff2_cmp( $a, $b ) { - if ( !is_array( $a ) ) { + if ( is_string( $a ) && is_string( $b ) ) { return strcmp( $a, $b ); } elseif ( count( $a ) !== count( $b ) ) { return count( $a ) < count( $b ) ? -1 : 1;