Skip to content

Commit

Permalink
Merged PR 54136: Fix exception in OrderSaveAfter
Browse files Browse the repository at this point in the history
## What's being changed

We're adding logic to prevent `unserialize()` of a null value in our OrderSaveAfter observer. We've also fixed an incorrect path reference in system.xml.

## Why it's being changed

In Magento 2.4.4-p1, [this change](magento/magento2@ad3e3cb#diff-35a4a7acd91fd572ad6de52c1030de9e9f047275a9590f98b2a66871ffcc444d) means that if no order status automations are set, there is an exception thrown each time an order is saved.

## How to review / test this change

- Ensure order status automations are empty
- Save an order (e.g. change its status from the admin)
- See no exception
- Add an order status automation for e.g. 'Processing'
- Save an order again (set it to 'Processing')
- Confirm that the contact is marked as not imported
- Confirm that the automation is queued

Related work items: #254722
  • Loading branch information
sta1r committed May 23, 2024
1 parent 37c4645 commit d30d30d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Observer/Sales/OrderSaveAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ private function statusCheckAutomationEnrolment($order, $status, $customerEmail,
$storeId
);

if (null === $orderStatusAutomations) {
return;
}

try {
$configStatusAutomationMap = $this->serializer->unserialize($orderStatusAutomations);
if (!is_array($configStatusAutomationMap)) {
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<first_order_automation>0</first_order_automation>
</visitor_automation>
<order_status_automation>
<status_to_automation></status_to_automation>
<program></program>
</order_status_automation>
<review_settings>
<enabled>0</enabled>
Expand Down

0 comments on commit d30d30d

Please sign in to comment.