Closed (fixed)
Project:
Domain
Version:
3.0.0-beta5
Component:
- Domain Alias
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Feb 2026 at 17:25 UTC
Updated:
11 Mar 2026 at 19:25 UTC
Jump to comment: Most recent
Comments
Comment #2
mably commentedThanks @kergand for creating an issue. Investigating.
Comment #4
mably commentedRoot cause
DomainAliasForm::validateForm()was validating$this->entity->toArray()directly, but never called$this->buildEntity()first. In Drupal's EntityForm lifecycle,validateForm()runs beforesubmitForm(), so the entity still has its default property values — not the submitted form values.For a new alias, the
$redirectproperty onDomainAliashas no default value, so it isNULL. The config schema defines aChoiceconstraint allowing only[0, 301, 302], andNULLdoes not match — hence the validation error "The value you selected is not a valid choice."A secondary issue: HTML
<select>elements always submit string values ("0","301","302"), but the schemaChoiceconstraint compares against integers. Even after building the entity from form values, the string-to-integer mismatch would still cause a failure without an explicit cast.Fix
Two changes in
DomainAliasForm::validateForm():redirectform value to(int)before building the entity, so the integer type matches the schema'sChoiceconstraint.$this->buildEntity($form, $form_state)to populate the entity from submitted form values before running validation — instead of validating the stale$this->entity.Test coverage
Added
DomainAliasFormTest— a functional test that submits the alias creation form via the UI for each valid redirect value (0, 301, 302), then edits an existing alias to change its redirect. Verified that the test fails without the fix and passes with it.Comment #5
mably commented@kergand can you confirm that this issue's MR fixes the problem? Thanks.
Comment #6
kergand commentedYes, it seems now is ok
Comment #8
mably commentedThanks. Merged.