Index: trunk/phase3/languages/Language.php |
— | — | @@ -2153,6 +2153,7 @@ |
2154 | 2154 | if ( strlen( $string ) <= abs( $length ) ) { |
2155 | 2155 | return $string; |
2156 | 2156 | } |
| 2157 | + $stringOriginal = $string; |
2157 | 2158 | if( $length > 0 ) { |
2158 | 2159 | $string = substr( $string, 0, $length ); |
2159 | 2160 | $char = ord( $string[strlen( $string ) - 1] ); |
— | — | @@ -2166,7 +2167,13 @@ |
2167 | 2168 | # We chopped in the middle of a character; remove it |
2168 | 2169 | $string = $m[1]; |
2169 | 2170 | } |
2170 | | - return $string . $ellipsis; |
| 2171 | + # Do not truncate if the ellipsis actually make the string longer. Bug 22181 |
| 2172 | + if ( strlen( $string ) + strlen( $ellipsis ) < strlen( $stringOriginal ) ) { |
| 2173 | + return $string . $ellipsis; |
| 2174 | + } else { |
| 2175 | + return $stringOriginal; |
| 2176 | + } |
| 2177 | + |
2171 | 2178 | } else { |
2172 | 2179 | $string = substr( $string, $length ); |
2173 | 2180 | $char = ord( $string[0] ); |
— | — | @@ -2174,7 +2181,12 @@ |
2175 | 2182 | # We chopped in the middle of a character; remove the whole thing |
2176 | 2183 | $string = preg_replace( '/^[\x80-\xbf]+/', '', $string ); |
2177 | 2184 | } |
2178 | | - return $ellipsis . $string; |
| 2185 | + # Do not truncate if the ellipsis actually make the string longer. Bug 22181 |
| 2186 | + if ( strlen( $string ) + strlen( $ellipsis ) < strlen( $stringOriginal ) ) { |
| 2187 | + return $ellipsis . $string; |
| 2188 | + } else { |
| 2189 | + return $stringOriginal; |
| 2190 | + } |
2179 | 2191 | } |
2180 | 2192 | } |
2181 | 2193 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -724,6 +724,7 @@ |
725 | 725 | and Chick skins |
726 | 726 | * Fixed bug involving unclosed "-{" markup in the language converter |
727 | 727 | * (bug 21870) No longer include Google logo from an external server on wiki error. |
| 728 | +* (bug 22181) Do not truncate if the ellipsis actually make the string longer |
728 | 729 | |
729 | 730 | == API changes in 1.16 == |
730 | 731 | |