lat9 / upsoauth

A Zen Cart UPS shipping module that makes use of UPS' RESTful/Oauth API
GNU General Public License v2.0
3 stars 3 forks source link

Correct PHP Warning on empty response #7

Closed lat9 closed 1 year ago

lat9 commented 1 year ago

From the zen-cart support thread:

I received a warning today. Plug-in version v1.0.0. Zc 1.5.7d. PHP 7.4

[26-Jun-2023 14:39:21 America/New_York] Request URI: /ajax.php?act=ajaxOnePageCheckout&method=updateShipping
#1 upsoauth->getConfiguredUpsQuotes() called at [/includes/modules/shipping/upsoauth.php:383]
#2 upsoauth->quote() called at [/includes/classes/shipping.php:174]
#3 shipping->quote() called at [/includes/classes/ajax/zcAjaxOnePageCheckout.php:163]
#4 zcAjaxOnePageCheckout->updateShipping() called at [/ajax.php:85]
--> PHP Warning: Invalid argument supplied for foreach() in /includes/modules/shipping/upsoauth.php on line 642.

Line 642 is the following:

foreach ($all_ups_quotes->RateResponse->RatedShipment as $next_shipment) {