Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Warning: Undefined array key "value_referencer" in Drupal\Core\Logger\LoggerChannel->log() #4207

Closed
1 task done
swirtSJW opened this issue Jun 28, 2024 · 3 comments · Fixed by #4217
Closed
1 task done

Comments

@swirtSJW
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Looking at either the revisions list page or comparing two revisions, there are multiple warnings and deprecation notices.

Expected Behavior

Ought to not see scary bits on the screen.

Steps To Reproduce

  1. Navigate to a dataset
  2. Click on the 'Revisions' tab
  3. See the page fill with multiple (~30) warnings like this.
Warning: Undefined array key "value_referencer" in Drupal\Core\Logger\LoggerChannel->log() (line 123 of core/lib/Drupal/Core/Logger/LoggerChannel.php).
Deprecated function: syslog(): Passing null to parameter #1 ($priority) of type int is deprecated in Drupal\syslog\Logger\SysLog->syslogWrapper() (line 114 of core/modules/syslog/src/Logger/SysLog.php).

  1. Using the "Compare selected revisions" button results in a similar cascade of Warnings.

Environment

- OS: Mac in DDEV, also on dev instance
- Node: -
- npm: -

Relevant log output

Warning: Undefined array key "value_referencer" in Drupal\Core\Logger\LoggerChannel->log() (line 123 of core/lib/Drupal/Core/Logger/LoggerChannel.php).
Drupal\Core\Logger\LoggerChannel->log('value_referencer', 'Property @property_id reference @uuid not found', Array) (Line: 171)
Drupal\metastore\Reference\Dereferencer->dereferenceSingle('distribution', '9f26f09e-4da9-5e90-867d-c44524f6fe43') (Line: 132)
Drupal\metastore\Reference\Dereferencer->dereferenceMultiple('distribution', Array) (Line: 100)
Drupal\metastore\Reference\Dereferencer->dereferencePropertyUuid('distribution', Array) (Line: 77)
Drupal\metastore\Reference\Dereferencer->dereferenceProperty('distribution', Object) (Line: 59)
Drupal\metastore\Reference\Dereferencer->dereference(Object) (Line: 157)
Drupal\metastore\LifeCycle\LifeCycle->datasetLoad(Object) (Line: 135)
Drupal\metastore\LifeCycle\LifeCycle->go('Load', Object) (Line: 75)
metastore_data_lifecycle(Object, 'load') (Line: 19)
metastore_entity_load(Array, 'node') (Line: 397)
Drupal\Core\Entity\EntityStorageBase->Drupal\Core\Entity\{closure}(Object, 'metastore') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_load', Object) (Line: 396)
Drupal\Core\Entity\EntityStorageBase->postLoad(Array) (Line: 661)
Drupal\Core\Entity\ContentEntityStorageBase->loadMultipleRevisions(Array) (Line: 634)
Drupal\Core\Entity\ContentEntityStorageBase->loadRevision(1723421) (Line: 208)
Drupal\diff\Form\RevisionOverviewForm->buildForm(Array, Object, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('revision_overview_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm('Drupal\diff\Form\RevisionOverviewForm', Object) (Line: 224)
Drupal\Core\Form\FormBuilder->getForm('Drupal\diff\Form\RevisionOverviewForm', Object) (Line: 25)
Drupal\diff\Controller\NodeRevisionController->revisionOverview(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 52)
Drupal\pqdc\Middleware\Redirect->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: 53)
Asm89\Stack\Cors->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)
Deprecated function: syslog(): Passing null to parameter #1 ($priority) of type int is deprecated in Drupal\syslog\Logger\SysLog->syslogWrapper() (line 114 of core/modules/syslog/src/Logger/SysLog.php).
Drupal\syslog\Logger\SysLog->syslogWrapper(NULL, 'https://dev-edit.pdc.cms.gov|1719610944|dkan|184.25.157.153|https://dev-edit.pdc.cms.gov/node/2746/revisions|https://dev-edit.pdc.cms.gov/node/2746/revisions|1131||Property distribution reference '9f26f09e-4da9-5e90-867d-c44524f6fe43' not found') (Line: 102)
Drupal\syslog\Logger\SysLog->log(NULL, 'Property distribution reference '9f26f09e-4da9-5e90-867d-c44524f6fe43' not found', Array) (Line: 127)
Drupal\Core\Logger\LoggerChannel->log(NULL, 'Property @property_id reference @uuid not found', Array) (Line: 171)
Drupal\metastore\Reference\Dereferencer->dereferenceSingle('distribution', '9f26f09e-4da9-5e90-867d-c44524f6fe43') (Line: 132)
Drupal\metastore\Reference\Dereferencer->dereferenceMultiple('distribution', Array) (Line: 100)
Drupal\metastore\Reference\Dereferencer->dereferencePropertyUuid('distribution', Array) (Line: 77)
Drupal\metastore\Reference\Dereferencer->dereferenceProperty('distribution', Object) (Line: 59)
Drupal\metastore\Reference\Dereferencer->dereference(Object) (Line: 157)
Drupal\metastore\LifeCycle\LifeCycle->datasetLoad(Object) (Line: 135)
Drupal\metastore\LifeCycle\LifeCycle->go('Load', Object) (Line: 75)
metastore_data_lifecycle(Object, 'load') (Line: 19)
metastore_entity_load(Array, 'node') (Line: 397)
Drupal\Core\Entity\EntityStorageBase->Drupal\Core\Entity\{closure}(Object, 'metastore') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_load', Object) (Line: 396)
Drupal\Core\Entity\EntityStorageBase->postLoad(Array) (Line: 661)
Drupal\Core\Entity\ContentEntityStorageBase->loadMultipleRevisions(Array) (Line: 634)
Drupal\Core\Entity\ContentEntityStorageBase->loadRevision(1723421) (Line: 208)
Drupal\diff\Form\RevisionOverviewForm->buildForm(Array, Object, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('revision_overview_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm('Drupal\diff\Form\RevisionOverviewForm', Object) (Line: 224)
Drupal\Core\Form\FormBuilder->getForm('Drupal\diff\Form\RevisionOverviewForm', Object) (Line: 25)
Drupal\diff\Controller\NodeRevisionController->revisionOverview(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 52)
Drupal\pqdc\Middleware\Redirect->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: 53)
Asm89\Stack\Cors->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)

Anything else?

The relevant bit of code in Drupal 10.3 has not changed in 10 yrs
https://git.drupalcode.org/project/drupal/-/blob/10.3.x/core/lib/Drupal/Core/Logger/LoggerChannel.php?ref_type=heads&blame=1#L49

The relative bit of code in DKAN changed 3 months ago.
https://github.com/GetDKAN/dkan/blame/db9ceb6fa5a5f752b9be0d05ff21b64c2b579ce6/modules/metastore/src/Reference/Referencer.php#L191C7-L191C7

@paul-m
Copy link
Contributor

paul-m commented Jul 8, 2024

I'm unable to reproduce this. I create a new DKAN site and use the sample_content module to create datasets. I visit the revision tab for a dataset and it displays fine, without any errors.

It's entirely possible that there's an edge case we're not testing for here because the coverage report says the code in the Dereferencer class is not covered. In fact there are two places where we call log(), and only one has coverage. The Referencer class has two log() calls as well, and neither has coverage.

Recommendation:

  • Figure out the specifics for how to repro.
  • Add a kernel test that hits the calls to log() in the Referencer and Dereferencer classes.
  • Examine other changes from the LoggerTrait deprecation and see if we need coverage/fixes for those, too. Deprecate LoggerTrait #4140

@swirtSJW
Copy link
Contributor Author

swirtSJW commented Jul 9, 2024

My guess is that it will go away when this #4217 is merged.

@stefan-korn
Copy link
Contributor

stefan-korn commented Jul 15, 2024

Sorry, I have created a duplicate at #4226 . Closed #4226

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants