diff --git a/core/modules/workflows/src/Form/WorkflowStateAddForm.php b/core/modules/workflows/src/Form/WorkflowStateAddForm.php index 13a99ee..aee9c94 100644 --- a/core/modules/workflows/src/Form/WorkflowStateAddForm.php +++ b/core/modules/workflows/src/Form/WorkflowStateAddForm.php @@ -89,7 +89,7 @@ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, try { // Replicate the validation that Workflow::addState() does internally as the // form values have not been validated at this point. - if (!$entity->hasState($values['id']) && !preg_match('/[^a-z0-9_]+|^[0-9]+$/', $values['id'])) { + if (!$entity->hasState($values['id'])) { $entity->addState($values['id'], $values['label']); if (isset($values['type_settings'])) { $configuration = $entity->getTypePlugin()->getConfiguration(); @@ -99,7 +99,7 @@ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, } } } - catch (\Exception $e) { + catch (\InvalidArgumentException $e) { // Do nothing, if there is an exception we want validation to handle it. } } diff --git a/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php b/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php index 469daa1..2927043 100644 --- a/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php +++ b/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php @@ -117,7 +117,7 @@ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, $entity->set('type_settings', $configuration); } } - catch (\Exception $e) { + catch (\InvalidArgumentException $e) { // Do nothing, if there is an exception we want validation to handle it. } }