Skip to content

Commit bf2c4c6

Browse files
committed
Fixed project-config/apply error when gateway orderCondition is removed
Added array check for `$event->newValue` in `handleChangedGateway()` to handle cases where nested config keys are removed, which can cause the event to fire with non-array data. This matches the pattern used in `craft\services\Fields::handleChangedField()`. Fixes #4185
1 parent 3ca0c93 commit bf2c4c6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/services/Gateways.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,11 @@ public function handleChangedGateway(ConfigEvent $event): void
295295
$gatewayUid = $event->tokenMatches[0];
296296
$data = $event->newValue;
297297

298+
// Bail if the data is not a valid gateway config array
299+
if (!is_array($data)) {
300+
return;
301+
}
302+
298303
$transaction = Craft::$app->getDb()->beginTransaction();
299304
try {
300305
$gatewayRecord = $this->_getGatewayRecord($gatewayUid);

0 commit comments

Comments
 (0)