Missing field config for User entity causes PHP errors

Created on 25 May 2023, over 1 year ago
Updated 8 January 2024, 12 months ago

Problem/Motivation

Updating a user with a custom name_field causes errors.
The problem seems to be with the field config for diff.
But /admin/config/content/diff/fields lists no USER entity.
The name field is a custom field on the user entity.

Name fields on content bundles are listed, Name fields on user entities are not.

Error message

    Warning: Undefined array key "compare_format" in Drupal\name\Plugin\diff\Field\NameFieldBuilder->build() (line 73 of modules/contrib/name/src/Plugin/diff/Field/NameFieldBuilder.php).

    Drupal\name\Plugin\diff\Field\NameFieldBuilder->build(Object) (Line: 94)
    Drupal\diff\DiffEntityParser->parseEntity(Object) (Line: 104)
    Drupal\diff\DiffEntityComparison->compareRevisions(Object, Object) (Line: 174)
    Drupal\elogger\Services\Elogger->entityDiff(Object) (Line: 465)
    Drupal\elogger\Services\Elogger->prepareEntityLogMessage('entity_update', Object) (Line: 523)
    Drupal\elogger\Services\Elogger->logEvent('entity_update') (Line: 43)
    _log_entity_event('entity_update', Object) (Line: 27)
    elogger_entity_update(Object)
    call_user_func_array(Object, Array) (Line: 426)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'elogger') (Line: 405)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 433)
    Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 251)
    Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 903)
    Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 598)
    Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 784)
    Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 523)
    Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 802)
    Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
    Drupal\Core\Entity\EntityBase->save() (Line: 46)
    Drupal\user\ProfileForm->save(Array, Object)
    call_user_func_array(Array, Array) (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 592)
    Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 320)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
    Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
    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}() (Line: 158)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

    Warning: Undefined array key "compare_format" in Drupal\name\Plugin\diff\Field\NameFieldBuilder->build() (line 73 of modules/contrib/name/src/Plugin/diff/Field/NameFieldBuilder.php).

    Drupal\name\Plugin\diff\Field\NameFieldBuilder->build(Object) (Line: 94)
    Drupal\diff\DiffEntityParser->parseEntity(Object) (Line: 105)
    Drupal\diff\DiffEntityComparison->compareRevisions(Object, Object) (Line: 174)
    Drupal\elogger\Services\Elogger->entityDiff(Object) (Line: 465)
    Drupal\elogger\Services\Elogger->prepareEntityLogMessage('entity_update', Object) (Line: 523)
    Drupal\elogger\Services\Elogger->logEvent('entity_update') (Line: 43)
    _log_entity_event('entity_update', Object) (Line: 27)
    elogger_entity_update(Object)
    call_user_func_array(Object, Array) (Line: 426)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'elogger') (Line: 405)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 433)
    Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 251)
    Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 903)
    Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 598)
    Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 784)
    Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 523)
    Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 802)
    Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
    Drupal\Core\Entity\EntityBase->save() (Line: 46)
    Drupal\user\ProfileForm->save(Array, Object)
    call_user_func_array(Array, Array) (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 592)
    Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 320)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
    Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
    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}() (Line: 158)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Proposed resolution

Add user entities to /admin/config/content/diff/fields so we can investigate the issue further.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇦🇹Austria maxilein

Live updates comments and jobs are added and updated live.
  • PHP 8.2

    The issue particularly affects sites running on PHP version 8.2.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024