eLogger is incompatible with diff module on user entity

Created on 19 August 2023, over 1 year ago
Updated 16 November 2023, about 1 year ago

Problem/Motivation

Cannot update password of user when elogger is installed.
Gives only warning, but in fact prevents normal operation.

Steps to reproduce

D10.1 (but happened ever since D9)
Edit user and change the password.

Gives the error

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: 181)
    Drupal\elogger\Services\Elogger->entityDiff(Object) (Line: 472)
    Drupal\elogger\Services\Elogger->prepareEntityLogMessage('entity_update', Object) (Line: 532)
    Drupal\elogger\Services\Elogger->logEvent('entity_update') (Line: 73)
    _log_entity_event('entity_update', Object) (Line: 50)
    elogger_entity_update(Object)
    call_user_func_array(Object, Array) (Line: 409)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'elogger') (Line: 388)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 416)
    Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 217)
    Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
    Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 564)
    Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
    Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 489)
    Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 806)
    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: 597)
    Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 325)
    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: 583)
    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: 166)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
    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: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    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: 181)
    Drupal\elogger\Services\Elogger->entityDiff(Object) (Line: 472)
    Drupal\elogger\Services\Elogger->prepareEntityLogMessage('entity_update', Object) (Line: 532)
    Drupal\elogger\Services\Elogger->logEvent('entity_update') (Line: 73)
    _log_entity_event('entity_update', Object) (Line: 50)
    elogger_entity_update(Object)
    call_user_func_array(Object, Array) (Line: 409)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'elogger') (Line: 388)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 416)
    Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 217)
    Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
    Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 564)
    Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
    Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 489)
    Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 806)
    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: 597)
    Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 325)
    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: 583)
    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: 166)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
    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: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

The screenshots show the field configuration on a user object. The field settings. And a field report from the better field reports module.
Is there any other info I can provide?

Proposed resolution

Maybe to someone of the maintainers of eLogger the error is obvious and easy to patch

Remaining tasks

I opened an issue https://www.drupal.org/project/diff/issues/3362609 🐛 Missing field config for User entity causes PHP errors Closed: duplicate which is ongoing.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

🇦🇹Austria maxilein

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @maxilein
  • 🇦🇹Austria maxilein

    For now I could only uninstall eLogger. Which is a pitty, because it is of great value!

  • 🇲🇩Moldova andrei.vesterli Chisinau

    Hi @maxilein

    I could not reproduce the issue. Can you post a video where you can show it? For now, I will put this issue in pause.

    Regards,
    Andrei

  • Status changed to Postponed: needs info over 1 year ago
  • 🇦🇹Austria maxilein

    Ha Andrei,

    what is particularly of interest to you?

    R, Max

  • 🇲🇩Moldova andrei.vesterli Chisinau

    Hi @maxilein

    I developed this module and I am the primary maintainer here. I have a complete interest in fixing this issue.

    Why asking?

    Andy

  • 🇦🇹Austria maxilein

    Hi Andy,
    sorry, my bad. That I did not doubt.
    What technical aspects would you like to see?
    Other than entering a new password, saving and then getting the above error?
    R,
    MAx

  • 🇲🇩Moldova andrei.vesterli Chisinau

    I've installed the latest version
    I am using the latest diff module version too.
    I did a password change for a user and I did not see any notices or misconfiguration.
    Can you write a screencast for this issue, so, I can see what you have?

  • 🇦🇹Austria maxilein

    Ok. So I have tried systematically uninstalling all modules that may have to do with user objects.
    There seems to be some incompatibility with the name field module .

    I did not uninstall the name field module itself (I had to remove a field before in order to uninstall). The moment one name_field on the user entity was deleted, the error was gone.

    I will investigate further during the coming days and also post the field configuration of the field in question.

  • 🇲🇩Moldova andrei.vesterli Chisinau

    Sure, take your time man!

  • 🇦🇹Austria maxilein

    Testing on D10.1.2
    name_field: latest dev - drupal/name (dev-1.x 8608958)
    elogger version: 1.1.10

    I can create a new user without any error.

    But the following error is created when saving an existing user with that above mentioned field (also pls see screenshots regarding that fields config).

    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: 147)
        Drupal\elogger\Services\Elogger->entityDiff(Object) (Line: 438)
        Drupal\elogger\Services\Elogger->prepareEntityLogMessage('entity_update', Object) (Line: 501)
        Drupal\elogger\Services\Elogger->logEvent('entity_update') (Line: 73)
        _log_entity_event('entity_update', Object) (Line: 50)
        elogger_entity_update(Object)
        call_user_func_array(Object, Array) (Line: 409)
        Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'elogger') (Line: 388)
        Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 416)
        Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 217)
        Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
        Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 564)
        Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
        Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 489)
        Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 806)
        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: 597)
        Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 325)
        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: 583)
        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: 182)
        Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
        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: 51)
        Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
        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: 147)
        Drupal\elogger\Services\Elogger->entityDiff(Object) (Line: 438)
        Drupal\elogger\Services\Elogger->prepareEntityLogMessage('entity_update', Object) (Line: 501)
        Drupal\elogger\Services\Elogger->logEvent('entity_update') (Line: 73)
        _log_entity_event('entity_update', Object) (Line: 50)
        elogger_entity_update(Object)
        call_user_func_array(Object, Array) (Line: 409)
        Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'elogger') (Line: 388)
        Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 416)
        Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 217)
        Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
        Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 564)
        Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
        Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 489)
        Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 806)
        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: 597)
        Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 325)
        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: 583)
        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: 182)
        Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
        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: 51)
        Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
        Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    

    Drupal says the changes have been saved. And I test that. Saving values - including the password change - seems to be working correctly.

    At the same time eLogger log registered a message:

    The <strong>user</strong> <a href="/users/test-hans" hreflang="en">Hans Test | Z</a> was updated by <a href="/users/myuser" hreflang="en">My User | Z</a> on <em>Saturday, September 2, 2023 - 12:19</em>.

  • Status changed to Active over 1 year ago
  • Status changed to Fixed about 1 year ago
  • 🇲🇩Moldova andrei.vesterli Chisinau

    Hi @maxilein

    I've added a major update to the module and pushed a new release. I've done a lot of tests on a new fresh D10 instance where the diff module is the latest and there are no issues.

    I will close this one as it's not relevant here. You can also update the module on your side and check it. If there are issues, re-open the ticket back. Thx a lot!

  • 🇦🇹Austria maxilein

    Thanks. I will try it!

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

Production build 0.71.5 2024