-
Notifications
You must be signed in to change notification settings - Fork 174
Description
What happened?
Description
When updating Craft Commerce from 5.3.13 to 5.5.0 on a development environment using a production database, ./craft project-config/apply fails with:
error: Undefined array key "name"
The error happens while applying project config changes for one specific gateway, right after removing its orderCondition key. It looks related to the new orderCondition handling and the m251112_120000_fix_null_gateway_order_condition migration that was added in the commit fixing #4172.
Relevant log output:
Applying changes from your project config files ...
- removing commerce.gateways.ef65f7cc-2da0-4689-84da-9e3dd33f23ce.orderCondition ...
- updating commerce.gateways.ef65f7cc-2da0-4689-84da-9e3dd33f23ce ...
error: Undefined array key "name"
The gateway referenced here corresponds to the project config file:
config/project/commerce/gateways/ef65f7cc-2da0-4689-84da-9e3dd33f23ce.yaml
There are no manual edits to this file beyond what the Control Panel and project config normally generate.
Steps to reproduce
-
Start from a project running Craft Commerce
5.3.13with project config enabled and at least one payment gateway configured (the one with UIDef65f7cc-2da0-4689-84da-9e3dd33f23cein my case). -
Take a copy of the production database and restore it to a local/development environment.
-
Update
craftcms/commerceincomposer.jsonfrom5.3.13to5.5.0, then run:composer update craftcms/commerce ./craft migrate/all
-
Run:
./craft project-config/apply
-
Observe that the command stops with:
- removing commerce.gateways.ef65f7cc-2da0-4689-84da-9e3dd33f23ce.orderCondition ... - updating commerce.gateways.ef65f7cc-2da0-4689-84da-9e3dd33f23ce ... error: Undefined array key "name"
Expected behavior
./craft project-config/applyshould complete successfully after the Commerce update.- The gateway’s
orderConditionshould be migrated/normalized correctly (including the case where it was previouslynullor missing), without triggering PHP warnings or errors. - Existing gateways should continue to work and be editable in the Control Panel.
Actual behavior
./craft project-config/applyfails witherror: Undefined array key "name"while applying config for the gatewayef65f7cc-2da0-4689-84da-9e3dd33f23ce.- Project config changes can’t be fully applied, so the instance is effectively stuck until the error is resolved.
- The error message points to an internal assumption that a
namekey exists in the gateway config array during project-config handling / migration of theorderCondition.
Note: The stack trace does not provide any additional information.
Craft CMS version
5.8.20
Craft Commerce version
5.5.0
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response