Skip to content

Commit dc9c4e2

Browse files
committed
MAGETWO-57461: [Backport] - Exception occurs when tracking shipment with invalid FedEx tracking number - for 2.0.x
- Fixed logic for case with empty timezone
1 parent 84c04d7 commit dc9c4e2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

app/code/Magento/Fedex/Model/Carrier.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,12 +1571,9 @@ private function processTrackingDetails(\stdClass $trackInfo)
15711571
'progressdetail' => [],
15721572
];
15731573

1574-
if (!empty($trackInfo->ShipTimestamp)) {
1575-
// Add default timezone in case if it is not present in string
1576-
if(!preg_match('/(.*)+(\+[0-9]+:[0-9]+)/', $trackInfo->ShipTimestamp)) {
1577-
$trackInfo->ShipTimestamp .= '+00:00';
1578-
}
1579-
$datetime = \DateTime::createFromFormat(\DateTime::ISO8601, $trackInfo->ShipTimestamp);
1574+
if (!empty($trackInfo->ShipTimestamp) &&
1575+
($datetime = \DateTime::createFromFormat(\DateTime::ISO8601, $trackInfo->ShipTimestamp)) !== false
1576+
) {
15801577
$result['shippeddate'] = $datetime->format('Y-m-d');
15811578
}
15821579

0 commit comments

Comments
 (0)