From d30d30da4fc1c1cace59d211dd529233188759cd Mon Sep 17 00:00:00 2001 From: Alastair Mucklow Date: Wed, 15 May 2024 15:48:52 +0000 Subject: [PATCH] Merged PR 54136: Fix exception in OrderSaveAfter ## 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](https://github.com/magento/magento2/commit/ad3e3cb6fce4da2dc45c6a21250e3ddd05e3f3d7#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 --- Observer/Sales/OrderSaveAfter.php | 4 ++++ etc/config.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Observer/Sales/OrderSaveAfter.php b/Observer/Sales/OrderSaveAfter.php index e04e19f6..890cfbf0 100755 --- a/Observer/Sales/OrderSaveAfter.php +++ b/Observer/Sales/OrderSaveAfter.php @@ -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)) { diff --git a/etc/config.xml b/etc/config.xml index 8ef6ef8d..672bba96 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -67,7 +67,7 @@ 0 - + 0