wfMsgReplaceArgs: Don't use count(), if the actual amount of entries isn't needed
authorFlorian <florian.schmidt.stargatewissen@gmail.com>
Wed, 13 Jan 2016 17:55:08 +0000 (18:55 +0100)
committerFlorianschmidtwelzow <florian.schmidt.stargatewissen@gmail.com>
Sat, 30 Jan 2016 21:31:08 +0000 (21:31 +0000)
The only use of the return value of count() is, to check, if the array is empty or
not. This can be done in an easier way and a bit more performant, especially for
large arrays.

Change-Id: If119ead9230ba1783b8c853c18c379f174910e51

includes/GlobalFunctions.php

index 4d0ebf6..4066945 100644 (file)
@@ -1475,7 +1475,7 @@ function wfMsgReplaceArgs( $message, $args ) {
        $message = str_replace( "\r", '', $message );
 
        // Replace arguments
-       if ( count( $args ) ) {
+       if ( is_array( $args ) && $args ) {
                if ( is_array( $args[0] ) ) {
                        $args = array_values( $args[0] );
                }