Closed mischabraam closed 1 month ago
This error also happens on PHP 8.1 with Magento 2.4.5-p1. I've traced it to https://github.com/postcode-nl/PostcodeNl_Api_Magento2/blob/c7423e39405c89be5f0ffbd0f64465e777ea9a61/Block/Onepage/LayoutProcessor.php#L85 where the exception is thrown.
Customer Attributes is a module that is only available in Adobe Commerce. The Postcode.eu is developed only on Magento Open Source so we can't test this issue.
Any luck on this? I can imagine you don't have a Commerce license. Though many retailers do. It would be a shame not to support that.
In PHP 8, accessing an array key by reference that doesn't exist will create that key in the array with NULL value That's exactly what happens in the module
Here is the path for fixing it:
diff --git vendor/postcode-nl/api-magento2-module/Block/Onepage/LayoutProcessor.php vendor/postcode-nl/api-magento2-module/Block/Onepage/LayoutProcessor.php
--- vendor/postcode-nl/api-magento2-module/Block/Onepage/LayoutProcessor.php
+++ vendor/postcode-nl/api-magento2-module/Block/Onepage/LayoutProcessor.php (date 1725623104896)
@@ -87,20 +87,32 @@
}
}
- // Billing address on payment page
- $billingFields = &$jsLayout['components']
- ['checkout']['children']
- ['steps']['children']
- ['billing-step']['children']
- ['payment']['children']
- ['afterMethods']['children']
- ['billing-address-form']['children']
- ['form-fields']['children'];
+ if (isset(
+ $jsLayout['components']
+ ['checkout']['children']
+ ['steps']['children']
+ ['billing-step']['children']
+ ['payment']['children']
+ ['afterMethods']['children']
+ ['billing-address-form']['children']
+ ['form-fields']['children']
+ )
+ ) {
+ // Billing address on payment page
+ $billingFields = &$jsLayout['components']
+ ['checkout']['children']
+ ['steps']['children']
+ ['billing-step']['children']
+ ['payment']['children']
+ ['afterMethods']['children']
+ ['billing-address-form']['children']
+ ['form-fields']['children'];
- if (isset($billingFields)) {
- $billingFields += $this->_updateCustomScope($autofillFields, 'billingAddressshared');
- $billingFields = $this->_updateDataScope($billingFields, 'billingAddressshared');
- $billingFields = $this->_changeAddressFieldsPosition($billingFields);
+ if (isset($billingFields)) {
+ $billingFields += $this->_updateCustomScope($autofillFields, 'billingAddressshared');
+ $billingFields = $this->_updateDataScope($billingFields, 'billingAddressshared');
+ $billingFields = $this->_changeAddressFieldsPosition($billingFields);
+ }
}
// Compatibility
Thank you yuriichayka. We'll add a fix for this side effect to the next release.
With the module version 3.1.7.1 on Magento 2.4.5 on PHP 7.4 I receive the following critical error in the log.
The module is enabled when I get this error and the checkout is not usable for customers. If I disable the module using configuration in Magento's admin the checkout works correct.