Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: round(): Argument #1 ($num) must be of type int|float #1403

Merged
merged 2 commits into from
Jan 19, 2021

Conversation

Flyingmana
Copy link
Contributor

Description (*)

PHP 8 now limits round() to only float/int params, no string anymore.

related stacktrace:


Fatal error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in /var/www/html/src/htdocs/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php:752 Stack trace: 
#0 /var/www/html/src/htdocs/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php(752): round('', 3) 
#1 /var/www/html/src/htdocs/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php(771): Mage_Usa_Model_Shipping_Carrier_Dhl_International->_getDimension('') 
#2 /var/www/html/src/htdocs/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php(710): Mage_Usa_Model_Shipping_Carrier_Dhl_International->_addDimension(Object(SimpleXMLElement)) 
#3 /var/www/html/src/htdocs/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php(884): Mage_Usa_Model_Shipping_Carrier_Dhl_International->_makePieces(Object(SimpleXMLElement)) 
#4 /var/www/html/src/htdocs/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php(796): Mage_Usa_Model_Shipping_Carrier_Dhl_International->_buildQuotesRequestXml() 
#5 /var/www/html/src/htdocs/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php(230): Mage_Usa_Model_Shipping_Carrier_Dhl_International->_getQuotes() 
#6 /var/www/html/src/htdocs/app/code/core/Mage/Shipping/Model/Shipping.php(209): Mage_Usa_Model_Shipping_Carrier_Dhl_International->collectRates(Object(Mage_Shipping_Model_Rate_Request)) 
#7 /var/www/html/src/htdocs/app/code/core/Mage/Shipping/Model/Shipping.php(129): Mage_Shipping_Model_Shipping->collectCarrierRates('dhlint', Object(Mage_Shipping_Model_Rate_Request)) 
#8 /var/www/html/src/htdocs/app/code/core/Mage/Sales/Model/Quote/Address.php(1034): Mage_Shipping_Model_Shipping->collectRates(Object(Mage_Shipping_Model_Rate_Request)) 
#9 /var/www/html/src/htdocs/app/code/core/Mage/Sales/Model/Quote/Address.php(965): Mage_Sales_Model_Quote_Address->requestShippingRates() 
#10 /var/www/html/src/htdocs/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php(150): Mage_Sales_Model_Quote_Address->collectShippingRates() 
#11 /var/www/html/src/htdocs/app/code/core/Mage/Sales/Model/Quote/Address.php(1103): Mage_Sales_Model_Quote_Address_Total_Shipping->collect(Object(Mage_Sales_Model_Quote_Address)) 
#12 /var/www/html/src/htdocs/app/code/core/Mage/Sales/Model/Quote.php(1452): Mage_Sales_Model_Quote_Address->collectTotals() 
#13 /var/www/html/src/htdocs/app/code/core/Mage/Checkout/Model/Cart.php(462): Mage_Sales_Model_Quote->collectTotals() 
#14 /var/www/html/src/htdocs/app/code/core/Mage/Checkout/controllers/CartController.php(159): Mage_Checkout_Model_Cart->save() 
#15 /var/www/html/src/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(437): Mage_Checkout_CartController->indexAction() 
#16 /var/www/html/src/htdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(262): Mage_Core_Controller_Varien_Action->dispatch('index') 
#17 /var/www/html/src/htdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(192): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) 
#18 /var/www/html/src/htdocs/app/code/core/Mage/Core/Model/App.php(381): Mage_Core_Controller_Varien_Front->dispatch() 
#19 /var/www/html/src/htdocs/app/Mage.php(737):

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes OpenMage/magento-lts#<issue_number>

Manual testing scenarios (*)

use the shipping estimation feature on the cart page.

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

@github-actions github-actions bot added Component: Core Relates to Mage_Core Component: lib/Zend Component: lib/* Relates to lib/* Component: PayPal Relates to Mage_Paypal Component: Usa Relates to Mage_Usa labels Jan 18, 2021
@Flyingmana Flyingmana added the PHP 8 Related to PHP8 label Jan 18, 2021
@Flyingmana Flyingmana merged commit 5580c34 into OpenMage:1.9.4.x Jan 19, 2021
@github-actions
Copy link
Contributor

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
2 runs  ±0  2 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 5580c34. ± Comparison against base commit 62d9431.

@sreichel sreichel added this to the Release 19.4.10 / 20.0.6 milestone Jan 19, 2021
Copy link

@dford-avb dford-avb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed a correction to type cast to float insidde round() method on line 752 Dhl/International.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Relates to Mage_Core Component: lib/* Relates to lib/* Component: PayPal Relates to Mage_Paypal Component: Usa Relates to Mage_Usa PHP 8 Related to PHP8
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants