This affects payment gateways, offers, tax types, you name it.

Let's say a promotion has two possible offers, one has an "amount" of type "number", the other of type "commerce_price".
Changing from one offer to another will trigger a crash in NestedArray::setValue().
The plugin select form element has an #after_build callback to clear plugin config on plugin change, but it runs too late.

Comments

bojanz created an issue. See original summary.

bojanz’s picture

I tried moving the clearing logic to the form builder method (such as processPluginSelect), but the crash still occurred.
This is a core issue, and we'll need to be creative to get around it.

The only reasonable workaround is to modify the plugin configuration #parents so that each configuration is keyed by plugin ID.
That way there's no overlap between different plugin configurations.

  • bojanz committed 695266b on 8.x-2.x
    Issue #2885575 by bojanz: Switching plugins can crash if both share a...
bojanz’s picture

Status: Active » Fixed

This was a fun one, and took hours.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.