From: Santhosh Thottingal Date: Tue, 15 Nov 2011 04:28:34 +0000 (+0000) Subject: Follow up r102802. Bug 32359 X-Git-Tag: 1.31.0-rc.0~26496 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=a4bc93ae50518e117f7a60e885e8f92e27773761;p=lhc%2Fweb%2Fwiklou.git Follow up r102802. Bug 32359 Use negative sign itself instead of $_[0] since $_ is mixed type. Add more test cases. --- diff --git a/languages/Language.php b/languages/Language.php index 48fd882746..84e9cbdb91 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2725,7 +2725,7 @@ class Language { $sign = ""; if ( intval( $_ ) < 0 ) { // For negative numbers apply the algorithm like positive number and add sign. - $sign = $_[0]; + $sign = "-"; $_ = substr( $_,1 ); } $numberpart = array(); diff --git a/tests/phpunit/languages/LanguageMlTest.php b/tests/phpunit/languages/LanguageMlTest.php index c659e5c5e0..45091db827 100644 --- a/tests/phpunit/languages/LanguageMlTest.php +++ b/tests/phpunit/languages/LanguageMlTest.php @@ -28,5 +28,7 @@ class LanguageMlTest extends MediaWikiTestCase { $this->assertEquals( '.12345', $this->lang->formatNum( '.12345' ) ); $this->assertEquals( '-12,00,000', $this->lang->formatNum( '-1200000' ) ); $this->assertEquals( '-98', $this->lang->formatNum( '-98' ) ); + $this->assertEquals( '-98', $this->lang->formatNum( -98 ) ); + $this->assertEquals( '-1,23,45,678', $this->lang->formatNum( -12345678 ) ); } }