Skip to content

Commit 785a38a

Browse files
jayankaghoshShikha Mishra
authored and
Shikha Mishra
committed
cast formatted number to float
1 parent 63cc54b commit 785a38a

File tree

1 file changed

+3
-5
lines changed
  • app/code/Magento/Quote/Model/Quote/Address

1 file changed

+3
-5
lines changed

app/code/Magento/Quote/Model/Quote/Address/Total.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(
5656
public function setTotalAmount($code, $amount)
5757
{
5858
/* (Fixes issue #18027) Round the total amount to 4 decimal places, to avoid floating point overflows */
59-
$amount = is_float($amount) ? number_format($amount, 4) : $amount;
59+
$amount = is_float($amount) ? (float)number_format($amount, 4) : $amount;
6060

6161
$this->totalAmounts[$code] = $amount;
6262
if ($code != 'subtotal') {
@@ -77,7 +77,7 @@ public function setTotalAmount($code, $amount)
7777
public function setBaseTotalAmount($code, $amount)
7878
{
7979
/* (Fixes issue #18027) Round the total amount to 4 decimal places, to avoid floating point overflows */
80-
$amount = is_float($amount) ? number_format($amount, 4) : $amount;
80+
$amount = is_float($amount) ? (float)number_format($amount, 4) : $amount;
8181

8282
$this->baseTotalAmounts[$code] = $amount;
8383
if ($code != 'subtotal') {
@@ -173,9 +173,7 @@ public function getAllBaseTotalAmounts()
173173
//@codeCoverageIgnoreEnd
174174

175175
/**
176-
* Set the full info, which is used to capture tax related information.
177-
*
178-
* If a string is used, it is assumed to be serialized.
176+
* Set the full info, which is used to capture tax related information. If a string is used, it is assumed to be serialized.
179177
*
180178
* @param array|string $info
181179
* @return $this

0 commit comments

Comments
 (0)