Skip to content

Commit 092e23b

Browse files
committed
AC-13855: Penny rounding error in catalog rule
To fix rounding error in PHP 8.4
1 parent dc63f16 commit 092e23b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ protected function getStore($scope = null)
152152
public function round($price)
153153
{
154154
// To fix rounding error in PHP 8.4
155-
if (version_compare(PHP_VERSION, '8.4', '>=')) {
156-
return round((float)sprintf("%.3f", $price), 2);
157-
}
158-
return round((float) $price, 2);
155+
return round(
156+
floatval((string) $price),
157+
2
158+
);
159159
}
160160

161161
/**

0 commit comments

Comments
 (0)