merged master
[lhc/web/wiklou.git] / languages / Language.php
index 67389ec..7c66e5f 100644 (file)
@@ -2716,6 +2716,7 @@ class Language {
         *
         * @param $opposite Boolean Get the direction mark opposite to your language
         * @return string
+        * @since 1.20
         */
        function getDirMarkEntity( $opposite = false ) {
                if ( $opposite ) { return $this->isRTL() ? '‎' : '‏'; }
@@ -3006,6 +3007,7 @@ class Language {
         * Take a list of strings and build a locale-friendly comma-separated
         * list, using the local comma-separator message.
         * The last two strings are chained with an "and".
+        * NOTE: This function will only work with standard numeric array keys (0, 1, 2…)
         *
         * @param $l Array
         * @return string
@@ -3013,7 +3015,10 @@ class Language {
        function listToText( array $l ) {
                $s = '';
                $m = count( $l ) - 1;
-               if ( $m == 1 ) {
+               
+               if ( $m === 0 ) {
+                       return $l[0];
+               } elseif ( $m === 1 ) {
                        return $l[0] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $l[1];
                } else {
                        for ( $i = $m; $i >= 0; $i-- ) {
@@ -3927,6 +3932,7 @@ class Language {
         * @param $format Bool|Int true to process using language functions, or TS_ constant
         *     to return the expiry in a given timestamp
         * @return String
+        * @since 1.18
         */
        public function formatExpiry( $expiry, $format = true ) {
                static $infinity, $infinityMsg;