Unable to edit existing extra field or render any public site pages

Created on 11 April 2024, 7 months ago

Problem/Motivation

I've just updated to v2.1.0-rc1, on a site running Drupal 9.5.11 using PHP 8.1.27. When trying to view any public page, or manage existing extra fields on a content type (bundle) using /admin/structure/types/manage/book/extra-fields, the page doesn't load. This works fine using v2.0.0-alpha5. The following is logged:

Warning: Undefined array key "entity_extra_field.book.reading_order_pager" in Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple() (line 202 of /public_html/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php)
#0 /public_html/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'Undefined array...', '/home/customer/...', 202)
#1 /public_html/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(202): _drupal_error_handler(2, 'Undefined array...', '/home/customer/...', 202)
#2 /public_html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(346): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(Array)
#3 /public_html/core/lib/Drupal/Core/Entity/EntityListBuilder.php(87): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#4 /public_html/core/lib/Drupal/Core/Entity/EntityListBuilder.php(218): Drupal\Core\Entity\EntityListBuilder->load()
#5 /public_html/core/lib/Drupal/Core/Entity/Controller/EntityListController.php(23): Drupal\Core\Entity\EntityListBuilder->render()
#6 [internal function]: Drupal\Core\Entity\Controller\EntityListController->listing('entity_extra_fi...')
#7 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#8 /public_html/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#9 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#10 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#11 /vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 /vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#13 /public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /public_html/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /public_html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#22 {main}
Error: Call to a member function getName() on null in Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple() (line 202 of /public_html/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php)
#0 /public_html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(346): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(Array)
#1 /public_html/core/lib/Drupal/Core/Entity/EntityListBuilder.php(87): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)

Etc.

πŸ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom natts London

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

Merge Requests

Comments & Activities

  • Issue created by @natts
  • πŸ‡ΊπŸ‡ΈUnited States capellic Austin, Texas

    Same issue here.

  • πŸ‡ΊπŸ‡ΈUnited States pdxclankeith

    Ran into the getName() null error on Drupal 10.2.5 after upgrading to 2.1.0-rc1.

  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith

    This is a regress from this issue πŸ› Unable to create extra field on user entity Fixed

    That changes the ID of the config - but there is no update hook provided to fix existing config.

    What is happening is that the the config storage loads all the configs which are keyed by the old id:

        foreach ($this->configFactory->loadMultiple($names) as $config) {
          $id = $config->get($this->idKey);
          $records[$id] = $this->overrideFree ? $config->getOriginal(NULL, FALSE) : $config->get();
          $configs[$id] = $config;
        }
        $entities = $this->mapFromStorageRecords($records);
    

    When it loops through the entities returned, they have the key id, so this thows an exception as $configs[$id] isn't set - configs is keyed by the old id.

        foreach ($entities as $id => $entity) {
          $self_referring_cache_tag = ['config:' . $configs[$id]->getName()];

    This module needs an update hook to fix the old configs.

  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith

    Opened MR to revert the change which I believe is accidental.

    This will still need an update hook I believe, as this will cause the same issue for people who have created config from 2.1.0-rc1 or when using the committed diff as a patch (as indicated in the related issue, some people are using the committed change already having updated the config ids themselves).

    Setting needs work as I think with or without the id revert this will need an update hook to ensure what is in configuration matches what the entity generates for its id.

  • Status changed to Needs work 7 months ago
  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith
  • Status changed to Needs review 7 months ago
  • Hello,
    After installing the module, the two errors are occurring, one is while creating a new extra field and another is when editing the existing extra field.
    ERRORS:
    1. Error: Typed property Drupal\entity_extra_field\Entity\EntityExtraField::$name must not be accessed before initialization
    2. Error: Call to a member function getName() on null

    Solution:
    To resolve above two errors, created a patch. Please review the attached patch file.
    Thank you!

  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith

    Hi arora.shivani,

    There is a different issue reported in πŸ› Unable to add an extra field on a content type/bundle that has no extra fields already Active which is specific to your first issue.

    There is already a patch in that issue that is the same as yours so it looks like that is another valid fix that needs to go in but this issue is about existing data not fresh installs.

    Please do follow up in that related issue that the patch works for you.

    Setting back to needs work based on my previous comment / MR.

  • Status changed to Needs work 7 months ago
  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith
  • Status changed to Needs review 7 months ago
  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith
  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith

    @arora.shivani - I took a look and the patch doesn't do anything for the errors reported specifically in this issue - I think my original comment stands that your issue is likely in πŸ› Unable to add an extra field on a content type/bundle that has no extra fields already Active

    Added an update hook to correct any broken config.

    This I think can be used for either case if the id change is reverted or not.

    It will help people who have either created config using the changed id format - or if the id format is not going to change back it will convert old config to the new format.

    The new format is I think a mistake, if you have the same bundle name across multiple entity types (rare but possible) this could lead to collision, I believe it was just a mistake that can be reverted.

  • πŸ‡¬πŸ‡§United Kingdom hoegrammer

    The MR worked for me, thanks

  • Status changed to RTBC 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States COBadger

    Marking MR15 as RTBC.

  • πŸ‡§πŸ‡ͺBelgium Vacilando Brussels

    #11 worked for me as well. Could this please be committed to dev at least?

  • First commit to issue fork.
  • πŸ‡©πŸ‡ͺGermany Grevil

    Rebased the branch. Should be mergable again (Didn't take a look at the code though).

  • πŸ‡¬πŸ‡§United Kingdom richard.lampitt

    I'm still getting this error on a client site of ours with 2.1.0-rc3 on core 10.3.6:

    Error: Call to a member function getName() on null in Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple() (line 206 of /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php).
    
    #0 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(NULL)
    #1 /home/virtual-server-name/client-name/public_html/httpdocs/modules/contrib/entity_extra_field/entity_extra_field.module(26): Drupal\Core\Entity\EntityStorageBase->loadMultiple()
    #2 [internal function]: entity_extra_field_entity_extra_field_info()
    #3 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): call_user_func_array(Object(Closure), Array)
    #4 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'entity_extra_fi...')
    #5 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Extension/ModuleHandler.php(423): Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_extra_fi...', Object(Closure))
    #6 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityFieldManager.php(676): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_extra_fi...')
    #7 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityFieldManager.php(649): Drupal\Core\Entity\EntityFieldManager->loadExtraFields()
    #8 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(173): Drupal\Core\Entity\EntityFieldManager->getExtraFields('node', 'page')
    #9 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(155): Drupal\Core\Entity\EntityDisplayBase->init()
    #10 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(181): Drupal\Core\Entity\EntityDisplayBase->__construct(Array, 'entity_view_dis...')
    #11 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(418): Drupal\Core\Entity\Entity\EntityViewDisplay->__construct(Array, 'entity_view_dis...')
    #12 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(186): Drupal\Core\Entity\EntityStorageBase->mapFromStorageRecords(Array)
    #13 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(Array)
    #14 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(121): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
    #15 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(281): Drupal\Core\Entity\Entity\EntityViewDisplay::collectRenderDisplays(Array, 'full')
    #16 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array)
    #17 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build(Array)
    #18 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array(Array, Array)
    #19 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
    #20 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
    #21 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender(Array, false)
    #22 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render(Array, false)
    #23 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
    #24 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(239): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #25 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
    #26 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
    #27 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #28 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #29 /home/virtual-server-name/client-name/public_html/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
    #30 /home/virtual-server-name/client-name/public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #31 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #32 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #33 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #34 /home/virtual-server-name/client-name/public_html/httpdocs/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #35 /home/virtual-server-name/client-name/public_html/httpdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #36 /home/virtual-server-name/client-name/public_html/httpdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #37 /home/virtual-server-name/client-name/public_html/httpdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #38 /home/virtual-server-name/client-name/public_html/httpdocs/modules/contrib/cleantalk/src/EventSubscriber/BootSubscriber.php(206): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #39 /home/virtual-server-name/client-name/public_html/httpdocs/modules/contrib/shield/src/ShieldMiddleware.php(263): Drupal\cleantalk\EventSubscriber\BootSubscriber->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #40 /home/virtual-server-name/client-name/public_html/httpdocs/modules/contrib/shield/src/ShieldMiddleware.php(130): Drupal\shield\ShieldMiddleware->bypass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #41 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\shield\ShieldMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #42 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #43 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #44 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #45 /home/virtual-server-name/client-name/public_html/httpdocs/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #46 /home/virtual-server-name/client-name/public_html/httpdocs/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #47 {main}
    
Production build 0.71.5 2024