Symptom

Saving the Domain Theme Switch configuration form on a site that does not have an admin theme set (or for a domain that has never had an admin theme override saved) emits a PHP warning:

Warning: Undefined array key "admin" in Drupal\domain_theme_switch\Form\DomainThemeSwitchConfigForm->submitForm() (line 207 of …/DomainThemeSwitchConfigForm.php)

Cause

Line 207 of submitForm() reads $system_theme_config['admin']. The admin key on Drupal core's system.theme config is optional — it is only present when an admin theme is explicitly configured. On the no-admin-theme baseline the key is missing.

The warning is non-fatal: $original_admin_theme resolves to NULL, the $original_admin_theme !== $new_admin comparison evaluates to TRUE, the override save still proceeds. But the warning floods the log on every submit.

Fix

Defensive fallback on lines 206–207 — ?? '' to default a missing key to an empty string. Symmetrical handling for both default and admin, even though default is always set on system.theme, so the code does not encode any assumption that depends on Drupal core internal storage details.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

  • mably committed 573bd6bb on 3.x
    fix: #3588930 Undefined array key "admin" warning in...
mably’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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