Email registration module when updated to 8.x-1.0-rc3 conflicts with Profile module and throws below exception -

Drupal\Core\Entity\EntityStorageException: Entity validation was skipped. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 756 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Email registration module version 8.x-1.x-dev (2015-Apr-03) works well. Updates in 8.x-1.0-rc3 version of username (E.g.
- $name = $account->getUsername();
+ $name = $account->getAccountName();
) throws exception and conflicts with Profile module (With both Profile version - 8.x-1.0-alpha4 and 8.x-1.x-dev)

Below is the detailed exception error -

Drupal\Core\Entity\EntityStorageException: Entity validation was skipped. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 756 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Drupal\user\Entity\User->preSave(Object) (Line: 434)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 291)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 389)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 747)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 358)
Drupal\Core\Entity\Entity->save() (Line: 47)
email_registration_user_insert(Object)
call_user_func_array('email_registration_user_insert', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('user_insert', Array) (Line: 167)
Drupal\Core\Entity\EntityStorageBase->invokeHook('insert', Object) (Line: 418)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('insert', Object) (Line: 470)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 304)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, ) (Line: 395)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 747)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 358)
Drupal\Core\Entity\Entity->save() (Line: 92)
Drupal\user\RegisterForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 583)
Drupal\Core\Form\FormBuilder->processForm('user_register_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

renukakulkarni created an issue. See original summary.

renukakulkarni’s picture

Title: Email registration conflicting with Profile module » Email registration module is conflicting with Profile module
R.Muilwijk’s picture

The user should first be validated if this is required.

R.Muilwijk’s picture

Status: Active » Needs review
kscheirer’s picture

Version: 8.x-1.0-rc3 » 8.x-1.x-dev
Priority: Critical » Major
Status: Needs review » Reviewed & tested by the community

Ran into the same issue, patch fixed it for me, thanks!

a.dmitriiev’s picture

The patch also worked for me, please add to DEV version at least.
Thanks!

greggles’s picture

I don't use Drupal 8 yet, so pardon if my feedback isn't useful.

I hear that there's an exception being thrown. It looks like this would prevent the exception and bail with an error in some cases. Is the proposed patch fixing the underlying bug or just hiding it?

kscheirer’s picture

I think this fixes the problem: "Entity validation was skipped". The patch allows validation to happen, we're not hiding the exception.

  • greggles committed 7392860 on 8.x-1.x authored by R.Muilwijk
    Issue #2777701 by R.Muilwijk, kscheirer: Email registration module is...
greggles’s picture

Title: Email registration module is conflicting with Profile module » Email registration module needs to do Profile validation prior to saving
Status: Reviewed & tested by the community » Fixed

Thanks for the explanation/pointers, Karl!

So the expectation is the logger call will happen infrequently and most of the time the code will actually continue to the save. Works for me.

Thanks to you, R.Muilwijk, and others for your help fixing this. It's committed now.

kscheirer’s picture

Thanks greggles!

Status: Fixed » Closed (fixed)

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

pfrenssen’s picture

Why was there no test added for this?

I'm asking because in #657472: Add setting to allow users to login with email address or username this code was removed again by accident and this didn't cause any failures. Luckily @andypost saw this and was familiar with this issue and prevented this fix from disappearing again.

Any fix that is not tested can regress at any point in the future.

greggles’s picture

@pfrenssen probably for the same reason most things aren't done: the people doing the work didn't think it was worth it. If you think it's worth it, please reopen the issue and add it :)

R.Muilwijk’s picture