diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php index 602f0e7..8eb4384 100644 --- a/core/modules/user/src/AccountForm.php +++ b/core/modules/user/src/AccountForm.php @@ -328,7 +328,9 @@ public function validate(array $form, FormStateInterface $form_state) { $account = $this->entity; // Validate new or changing username. if ($form_state->hasValue('name')) { - if ($error = user_validate_name($form_state->getValue('name'))) { + // HELP NEEDED: calling user_validate_name() just causes the form to + // complain that no username was supplied. + if (false && $error = user_validate_name($form_state->getValue('name'))) { $form_state->setErrorByName('name', $error); } // Cast the user ID as an integer. It might have been set to NULL, which diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php index 2da1887..99a9442 100644 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php @@ -419,7 +419,8 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups, // Scalar and null values in the collection are ignored // (BC with Symfony < 2.5) - if (is_object($value)) { + // HELP NEEDED: String can't be validated, I think we're recursing one level too far + if (is_object($value) && get_class($value) != 'Drupal\Core\TypedData\Plugin\DataType\String') { $this->validateObject( $value, $propertyPath.'['.$key.']', diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php index 8eb4384..602f0e7 100644 --- a/core/modules/user/src/AccountForm.php +++ b/core/modules/user/src/AccountForm.php @@ -328,9 +328,7 @@ public function validate(array $form, FormStateInterface $form_state) { $account = $this->entity; // Validate new or changing username. if ($form_state->hasValue('name')) { - // HELP NEEDED: calling user_validate_name() just causes the form to - // complain that no username was supplied. - if (false && $error = user_validate_name($form_state->getValue('name'))) { + if ($error = user_validate_name($form_state->getValue('name'))) { $form_state->setErrorByName('name', $error); } // Cast the user ID as an integer. It might have been set to NULL, which diff --git a/core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraintValidator.php b/core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraintValidator.php index 12d4fa3..887f50f 100644 --- a/core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraintValidator.php +++ b/core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraintValidator.php @@ -20,11 +20,17 @@ class UserNameConstraintValidator extends ConstraintValidator { * {@inheritdoc} */ public function validate($items, Constraint $constraint) { - if (!isset($items) || !$items->value) { + // HELP NEEDED: Why has $items changed from an object + // (presumably TypedData\ListInterface) into an array? + if (!isset($items)) { + $this->context->addViolation($constraint->emptyMessage); + return; + } + $name = is_array($items) ? $items[0]['value'] : $items->first()->value; + if (!$name) { $this->context->addViolation($constraint->emptyMessage); return; } - $name = $items->first()->value; if (substr($name, 0, 1) == ' ') { $this->context->addViolation($constraint->spaceBeginMessage); } diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php index 99a9442..c1cfbb5 100644 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php @@ -420,7 +420,7 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups, // Scalar and null values in the collection are ignored // (BC with Symfony < 2.5) // HELP NEEDED: String can't be validated, I think we're recursing one level too far - if (is_object($value) && get_class($value) != 'Drupal\Core\TypedData\Plugin\DataType\String') { + if (is_object($value) && ($value instanceof \Drupal\Core\TypedData\ComplexDataInterface || $value instanceof \Drupal\Core\TypedData\ListInterface)) { $this->validateObject( $value, $propertyPath.'['.$key.']',