UPSSdk::getShipmentShopRates() can return a non-nested array

Created on 21 March 2025, 18 days ago

Problem/Motivation

For certain requests, UPSRateRequest::getRates() can fail because the foreach ($ups_rates['RateResponse']['RatedShipment'] as $ups_rate) loop assumes that the $ups_rates['RateResponse']['RatedShipment'] is always a multidimensional array with each RatedShipment indexed under a number

0 = array
1 = array
2 = array

However, if there is only one RatedShipment then they are not indexed and instead the contents are directly inside the RatedShipment array. The foreach loop then splits them out and none of the expected array contents in $ups_rate are there causing a fatal php error.

Steps to reproduce

Create a shipment with the following address

Canada
123 Fake St
Iqaluit, Nunavut X0A2H0

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024