Skip to content

Commit 5580c34

Browse files
authored
TypeError: round(): Argument #1 ($num) must be of type int|float (OpenMage#1403)
* TypeError: round(): Argument #1 ($num) must be of type int|float
1 parent 62d9431 commit 5580c34

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

app/code/core/Mage/Core/Model/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ public function convertPrice($price, $format = false, $includeContainer = true)
10011001
*/
10021002
public function roundPrice($price)
10031003
{
1004-
return round($price, 2);
1004+
return round((float)$price, 2);
10051005
}
10061006

10071007
/**

app/code/core/Mage/Paypal/Model/Payflowpro.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function refund(Varien_Object $payment, $amount)
299299
$request = $this->_buildBasicRequest($payment);
300300
$request->setTrxtype(self::TRXTYPE_CREDIT);
301301
$request->setOrigid($payment->getParentTransactionId());
302-
$request->setAmt(round($amount,2));
302+
$request->setAmt(round((float)$amount,2));
303303
$response = $this->_postRequest($request);
304304
$this->_processErrors($response);
305305

app/code/core/Mage/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function _construct()
5959
);
6060

6161
$weight = round(
62-
Mage::helper('usa')->convertMeasureWeight(
62+
(float) Mage::helper('usa')->convertMeasureWeight(
6363
$kgWeight, Zend_Measure_Weight::KILOGRAM, Zend_Measure_Weight::POUND), 3);
6464

6565
$this->setDivideOrderWeightNoteLbp(

app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,24 +292,24 @@ public function setRequest(Varien_Object $request)
292292
$packageParams = $request->getPackageParams();
293293
$shippingWeight = $request->getPackageWeight();
294294
if ($packageParams->getWeightUnits() != Zend_Measure_Weight::POUND) {
295-
$shippingWeight = round(Mage::helper('usa')->convertMeasureWeight(
295+
$shippingWeight = round((float) Mage::helper('usa')->convertMeasureWeight(
296296
$request->getPackageWeight(),
297297
$packageParams->getWeightUnits(),
298298
Zend_Measure_Weight::POUND
299299
));
300300
}
301301
if ($packageParams->getDimensionUnits() != Zend_Measure_Length::INCH) {
302-
$packageParams->setLength(round(Mage::helper('usa')->convertMeasureDimension(
302+
$packageParams->setLength(round((float) Mage::helper('usa')->convertMeasureDimension(
303303
$packageParams->getLength(),
304304
$packageParams->getDimensionUnits(),
305305
Zend_Measure_Length::INCH
306306
)));
307-
$packageParams->setWidth(round(Mage::helper('usa')->convertMeasureDimension(
307+
$packageParams->setWidth(round((float) Mage::helper('usa')->convertMeasureDimension(
308308
$packageParams->getWidth(),
309309
$packageParams->getDimensionUnits(),
310310
Zend_Measure_Length::INCH
311311
)));
312-
$packageParams->setHeight(round(Mage::helper('usa')->convertMeasureDimension(
312+
$packageParams->setHeight(round((float) Mage::helper('usa')->convertMeasureDimension(
313313
$packageParams->getHeight(),
314314
$packageParams->getDimensionUnits(),
315315
Zend_Measure_Length::INCH
@@ -618,7 +618,7 @@ protected function _createShipmentXml($shipment, $shipKey)
618618
$apValue = ceil($apValue);
619619
break;
620620
case self::ADDITIONAL_PROTECTION_ROUNDING_ROUND:
621-
$apValue = round($apValue);
621+
$apValue = round((float) $apValue);
622622
break;
623623
default:
624624
case self::ADDITIONAL_PROTECTION_ROUNDING_FLOOR:

app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,13 @@ protected function _getWeight($weight, $maxWeight = false, $configWeightUnit = f
560560

561561
if ($configWeightUnit != $countryWeightUnit) {
562562
$weight = Mage::helper('usa')->convertMeasureWeight(
563-
round($weight,3),
563+
round((float) $weight,3),
564564
$configWeightUnit,
565565
$countryWeightUnit
566566
);
567567
}
568568

569-
return round($weight, 3);
569+
return round((float) $weight, 3);
570570
}
571571

572572
/**
@@ -748,7 +748,7 @@ protected function _getDimension($dimension, $configWeightUnit = false)
748748
$countryDimensionUnit = $this->getCode('dimensions_variables', $this->_getDimensionUnit());
749749

750750
if ($configDimensionUnit != $countryDimensionUnit) {
751-
$dimension = Mage::helper('usa')->convertMeasureDimension(
751+
$dimension = (float) Mage::helper('usa')->convertMeasureDimension(
752752
round($dimension, 3),
753753
$configDimensionUnit,
754754
$countryDimensionUnit

app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ protected function _formUsExpressShipmentRequest(Varien_Object $request)
13571357

13581358
$packageWeight = $request->getPackageWeight();
13591359
if ($packageParams->getWeightUnits() != Zend_Measure_Weight::OUNCE) {
1360-
$packageWeight = round(Mage::helper('usa')->convertMeasureWeight(
1360+
$packageWeight = round((float) Mage::helper('usa')->convertMeasureWeight(
13611361
$request->getPackageWeight(),
13621362
$packageParams->getWeightUnits(),
13631363
Zend_Measure_Weight::OUNCE
@@ -1449,7 +1449,7 @@ protected function _formUsSignatureConfirmationShipmentRequest(Varien_Object $re
14491449
$packageParams = $request->getPackageParams();
14501450
$packageWeight = $request->getPackageWeight();
14511451
if ($packageParams->getWeightUnits() != Zend_Measure_Weight::OUNCE) {
1452-
$packageWeight = round(Mage::helper('usa')->convertMeasureWeight(
1452+
$packageWeight = round((float) Mage::helper('usa')->convertMeasureWeight(
14531453
$request->getPackageWeight(),
14541454
$packageParams->getWeightUnits(),
14551455
Zend_Measure_Weight::OUNCE
@@ -1535,24 +1535,24 @@ protected function _formIntlShipmentRequest(Varien_Object $request)
15351535
);
15361536
}
15371537
if ($packageParams->getDimensionUnits() != Zend_Measure_Length::INCH) {
1538-
$length = round(Mage::helper('usa')->convertMeasureDimension(
1538+
$length = round((float) Mage::helper('usa')->convertMeasureDimension(
15391539
$packageParams->getLength(),
15401540
$packageParams->getDimensionUnits(),
15411541
Zend_Measure_Length::INCH
15421542
));
1543-
$width = round(Mage::helper('usa')->convertMeasureDimension(
1543+
$width = round((float) Mage::helper('usa')->convertMeasureDimension(
15441544
$packageParams->getWidth(),
15451545
$packageParams->getDimensionUnits(),
15461546
Zend_Measure_Length::INCH
15471547
));
1548-
$height = round(Mage::helper('usa')->convertMeasureDimension(
1548+
$height = round((float) Mage::helper('usa')->convertMeasureDimension(
15491549
$packageParams->getHeight(),
15501550
$packageParams->getDimensionUnits(),
15511551
Zend_Measure_Length::INCH
15521552
));
15531553
}
15541554
if ($packageParams->getGirthDimensionUnits() != Zend_Measure_Length::INCH) {
1555-
$girth = round(Mage::helper('usa')->convertMeasureDimension(
1555+
$girth = round((float) Mage::helper('usa')->convertMeasureDimension(
15561556
$packageParams->getGirth(),
15571557
$packageParams->getGirthDimensionUnits(),
15581558
Zend_Measure_Length::INCH

lib/Zend/Db/Profiler/Firebug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function queryEnd($queryId)
133133

134134
$this->_totalElapsedTime += $profile->getElapsedSecs();
135135

136-
$this->_message->addRow(array((string)round($profile->getElapsedSecs(),5),
136+
$this->_message->addRow(array((string)round((float) $profile->getElapsedSecs(),5),
137137
$profile->getQuery(),
138138
($params=$profile->getQueryParams())?$params:null));
139139

lib/Zend/Locale/Format.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,22 @@ public static function toNumber($value, array $options = array())
311311
$symbols = Zend_Locale_Data::getList($options['locale'], 'symbols');
312312
$oenc = self::_getEncoding();
313313
self::_setEncoding('UTF-8');
314-
314+
315315
// Get format
316316
$format = $options['number_format'];
317317
if ($format === null) {
318318
$format = Zend_Locale_Data::getContent($options['locale'], 'decimalnumber');
319319
$format = self::_seperateFormat($format, $value, $options['precision']);
320320

321321
if ($options['precision'] !== null) {
322-
$value = Zend_Locale_Math::normalize(Zend_Locale_Math::round($value, $options['precision']));
322+
$value = Zend_Locale_Math::normalize(Zend_Locale_Math::round((float) $value, $options['precision']));
323323
}
324324
} else {
325325
// seperate negative format pattern when available
326326
$format = self::_seperateFormat($format, $value, $options['precision']);
327327
if (strpos($format, '.')) {
328328
if (is_numeric($options['precision'])) {
329-
$value = Zend_Locale_Math::round($value, $options['precision']);
329+
$value = Zend_Locale_Math::round((float) $value, $options['precision']);
330330
} else {
331331
if (substr($format, iconv_strpos($format, '.') + 1, 3) == '###') {
332332
$options['precision'] = null;
@@ -338,7 +338,7 @@ public static function toNumber($value, array $options = array())
338338
}
339339
}
340340
} else {
341-
$value = Zend_Locale_Math::round($value, 0);
341+
$value = Zend_Locale_Math::round((float) $value, 0);
342342
$options['precision'] = 0;
343343
}
344344
$value = Zend_Locale_Math::normalize($value);

lib/Zend/Locale/Math.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public static function isBcmathDisabled()
6565
public static function round($op1, $precision = 0)
6666
{
6767
if (self::$_bcmathDisabled) {
68-
$op1 = round($op1, $precision);
68+
$op1 = round((float) $op1, $precision);
6969
if (strpos((string) $op1, 'E') === false) {
70-
return self::normalize(round($op1, $precision));
70+
return self::normalize(round((float) $op1, $precision));
7171
}
7272
}
7373

0 commit comments

Comments
 (0)