Skip to content

Commit 6235b5d

Browse files
committed
AC-13855: Penny rounding error in catalog rule
Better way to fix rounding error is to typecast to string instead of float which works both in 8.3 & 8.4
1 parent e66b9be commit 6235b5d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

app/code/Magento/Directory/Model/PriceCurrency.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,7 @@ protected function getStore($scope = null)
152152
*/
153153
public function round($price)
154154
{
155-
// To fix rounding error in PHP 8.4
156-
if (str_contains(PHP_VERSION, '8.4')) {
157-
return round(round((float) $price, 3), 2);
158-
}
159-
return round((float) $price, 2);
155+
return round((string) $price, 2);
160156
}
161157

162158
/**

0 commit comments

Comments
 (0)