Liangent has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/71300


Change subject: Drop a code path in wfBCP47() which is never reached.
......................................................................

Drop a code path in wfBCP47() which is never reached.

count( $codeSegment ) > 0 should be never true in a foreach loop of
$codeSegment itself. See also Iffe166f3.

Change-Id: I453b5ec3379951a2ad6e34b9835907c2eba3046b
---
M includes/GlobalFunctions.php
1 file changed, 10 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/00/71300/1

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index a44e45b..4f9347a 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -3750,22 +3750,17 @@
        $codeSegment = explode( '-', $code );
        $codeBCP = array();
        foreach ( $codeSegment as $segNo => $seg ) {
-               if ( count( $codeSegment ) > 0 ) {
-                       // when previous segment is x, it is a private segment 
and should be lc
-                       if ( $segNo > 0 && strtolower( $codeSegment[( $segNo - 
1 )] ) == 'x' ) {
-                               $codeBCP[$segNo] = strtolower( $seg );
-                       // ISO 3166 country code
-                       } elseif ( ( strlen( $seg ) == 2 ) && ( $segNo > 0 ) ) {
-                               $codeBCP[$segNo] = strtoupper( $seg );
-                       // ISO 15924 script code
-                       } elseif ( ( strlen( $seg ) == 4 ) && ( $segNo > 0 ) ) {
-                               $codeBCP[$segNo] = ucfirst( strtolower( $seg ) 
);
-                       // Use lowercase for other cases
-                       } else {
-                               $codeBCP[$segNo] = strtolower( $seg );
-                       }
+               // when previous segment is x, it is a private segment and 
should be lc
+               if ( $segNo > 0 && strtolower( $codeSegment[( $segNo - 1 )] ) 
== 'x' ) {
+                       $codeBCP[$segNo] = strtolower( $seg );
+               // ISO 3166 country code
+               } elseif ( ( strlen( $seg ) == 2 ) && ( $segNo > 0 ) ) {
+                       $codeBCP[$segNo] = strtoupper( $seg );
+               // ISO 15924 script code
+               } elseif ( ( strlen( $seg ) == 4 ) && ( $segNo > 0 ) ) {
+                       $codeBCP[$segNo] = ucfirst( strtolower( $seg ) );
+               // Use lowercase for other cases
                } else {
-               // Use lowercase for single segment
                        $codeBCP[$segNo] = strtolower( $seg );
                }
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/71300
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I453b5ec3379951a2ad6e34b9835907c2eba3046b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Liangent <liang...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to