Skip to content

Commit 99a6bdd

Browse files
committed
Merge branch '4.1'
* 4.1: Supress deprecation notices thrown when getting private servies from container in tests Uses `protected` for test functions [Messenger] Allow to scope handlers per bus do not mock the session in token storage tests [DependencyInjection] resolve array env vars Add Occitan plural rule Fix security/* cross-dependencies [Messenger] implement several senders using a ChainSender [Lock] Skip test if posix extension is not installed fix bug when imported routes are prefixed [DI] Allow defining bindings on ChildDefinition use strict compare in url validator Disallow illegal characters like "." in session.name [HttpKernel] do file_exists() check instead of silent notice Select alternatives on missing receiver arg or typo fix rounding from string
2 parents bcdf452 + 81a33d5 commit 99a6bdd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NumberFormatter/NumberFormatter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ private function round($value, $precision)
710710
} elseif (isset(self::$customRoundingList[$roundingModeAttribute])) {
711711
$roundingCoef = pow(10, $precision);
712712
$value *= $roundingCoef;
713+
$value = (float) (string) $value;
713714

714715
switch ($roundingModeAttribute) {
715716
case self::ROUND_CEILING:

Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ public function formatRoundingModeRoundHalfUpProvider()
428428
// array(1.125, '1.13'),
429429
array(1.127, '1.13'),
430430
array(1.129, '1.13'),
431+
array(1020 / 100, '10.20'),
431432
);
432433
}
433434

@@ -451,6 +452,7 @@ public function formatRoundingModeRoundHalfDownProvider()
451452
array(1.125, '1.12'),
452453
array(1.127, '1.13'),
453454
array(1.129, '1.13'),
455+
array(1020 / 100, '10.20'),
454456
);
455457
}
456458

@@ -474,6 +476,7 @@ public function formatRoundingModeRoundHalfEvenProvider()
474476
array(1.125, '1.12'),
475477
array(1.127, '1.13'),
476478
array(1.129, '1.13'),
479+
array(1020 / 100, '10.20'),
477480
);
478481
}
479482

@@ -498,6 +501,7 @@ public function formatRoundingModeRoundCeilingProvider()
498501
array(-1.123, '-1.12'),
499502
array(-1.125, '-1.12'),
500503
array(-1.127, '-1.12'),
504+
array(1020 / 100, '10.20'),
501505
);
502506
}
503507

@@ -522,6 +526,7 @@ public function formatRoundingModeRoundFloorProvider()
522526
array(-1.123, '-1.13'),
523527
array(-1.125, '-1.13'),
524528
array(-1.127, '-1.13'),
529+
array(1020 / 100, '10.20'),
525530
);
526531
}
527532

@@ -546,6 +551,7 @@ public function formatRoundingModeRoundDownProvider()
546551
array(-1.123, '-1.12'),
547552
array(-1.125, '-1.12'),
548553
array(-1.127, '-1.12'),
554+
array(1020 / 100, '10.20'),
549555
);
550556
}
551557

@@ -570,6 +576,7 @@ public function formatRoundingModeRoundUpProvider()
570576
array(-1.123, '-1.13'),
571577
array(-1.125, '-1.13'),
572578
array(-1.127, '-1.13'),
579+
array(1020 / 100, '10.20'),
573580
);
574581
}
575582

0 commit comments

Comments
 (0)