Problem/Motivation

When creating a new user the critical error happens.
Error backtrace:

Error: Typed property Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldValueValidator::$entityFieldManager must not be accessed before initialization in Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldValueValidator->validate() (line 54 of core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php).
Drupal\sharedemail\Plugin\Validation\Constraint\SharedEmailUniqueValidator->validate() (Line: 202)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints() (Line: 154)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (Line: 106)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate() (Line: 93)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate() (Line: 132)
Drupal\Core\TypedData\TypedData->validate() (Line: 518)
Drupal\Core\Entity\ContentEntityBase->validate() (Line: 188)
Drupal\Core\Entity\ContentEntityForm->validateForm()
call_user_func_array() (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
Drupal\Core\Form\FormValidator->validateForm() (Line: 593)
Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)
CommentFileSizeAuthor
#6 3420685-user-create-error-6.patch2.58 KBvadym.tseiko
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

dench0 created an issue. See original summary.

dench0’s picture

Status: Active » Needs review
baikho’s picture

Version: 3.0.0 » 3.x-dev

Thanks for raising this. It seems the parent Validator class in Core introduced these changes in 10.2.x via #2478663: UniqueFieldValueValidator works only with single value fields causing the breakage.

baikho’s picture

Status: Needs review » Needs work

The fix is failing on 10.1.x, so moving back to Needs work.

If we can't ensure compatibility for both 10.1.x and 10.2.x, then we may need to introduce a new release with updated version constraints or so.

vadym.tseiko’s picture

StatusFileSize
new2.58 KB

I added patch made from MR. Fix works for me - Drupal 10.2.6

marcob77’s picture

I have same error on 3.0.0 and applied the patch.
have no more error but now the system doesn't accept registration of a new user with same email address.

Tested again, was my fault. All seems to be ok.
Drupal version 10.2.7

finne’s picture

The fork diff (saved as local patch) works fine for me on D10.3.

As D10.1 was EOL over 1 year ago, I think we might fix this issue for current D10 users, and report a BC break if you are still on 10.1.

smulvih2’s picture

Status: Needs work » Reviewed & tested by the community

Tested #6 on D10.2.x and it fixes the issue for me.

kumkum29’s picture

Hello,

same problem on my site, I get a strange behavior : I get the error when I want to add media entity. With the patch, It's ok now !!

Do you think include the patch in the dev version ?

Thanks !

Drupal 10.3

  • 674d622f committed on 3.x
    Issue #3420685: Error when creating a new user
    

  • baikho committed c71e7b4a on 3.x
    Issue #3420685: Bumping core version requirement to ^10.2
baikho’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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