Imported reference has a TypeError: arrayfilter()

Created on 12 December 2023, 12 months ago
Updated 13 December 2023, 12 months ago

Problem/Motivation

After importing, opening a reference results in this error:

TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() (line 223 of /var/www/html/modules/contrib/bibcite/modules/bibcite_entity/src/Normalizer/ReferenceNormalizerBase.php)

#0 /var/www/html/modules/contrib/bibcite/modules/bibcite_entity/src/Normalizer/ReferenceNormalizerBase.php(223): array_filter()
#1 /var/www/html/modules/contrib/bibcite/modules/bibcite_entity/src/Normalizer/ReferenceNormalizerBase.php(353): Drupal\bibcite_entity\Normalizer\ReferenceNormalizerBase->convertEntityType()
#2 /var/www/html/modules/contrib/bibcite/modules/bibcite_entity/src/Normalizer/CslReferenceNormalizer.php(45): Drupal\bibcite_entity\Normalizer\ReferenceNormalizerBase->normalize()
#3 /var/www/html/vendor/symfony/serializer/Serializer.php(153): Drupal\bibcite_entity\Normalizer\CslReferenceNormalizer->normalize()
#4 /var/www/html/modules/contrib/bibcite/modules/bibcite_entity/src/ReferenceViewBuilder.php(85): Symfony\Component\Serializer\Serializer->normalize()
#5 /var/www/html/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(282): Drupal\bibcite_entity\ReferenceViewBuilder->buildComponents()
#6 /var/www/html/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#7 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
#8 /var/www/html/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#9 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#10 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
#11 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#12 /var/www/html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#13 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#14 /var/www/html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(243): Drupal\Core\Render\Renderer->executeInRenderContext()
#15 /var/www/html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#16 /var/www/html/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#17 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#18 /var/www/html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#19 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#20 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#21 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#22 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#23 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#24 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#25 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#26 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#27 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#28 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#29 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle()
#30 {main}

The page itself is a white page that says: The website encountered an unexpected error. Please try again later.

Steps to reproduce

Import any type of reference and click on the reference to go to its page.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: works as designed

Version

2.0

Component

User interface

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Assigned to abhishek_virasat
  • First commit to issue fork.
  • Status changed to Closed: works as designed 12 months ago
  • 🇵🇹Portugal rfmarcelino

    @london6339, this is not a bug of bibcite_import_orcid, bit related with the version of bibcite you're using.
    Likely, you're using version 2 with PHP8. Upgrade to version 3 and the problem will go away.

  • Thanks for clarifying @rfmarcelino.

    I have updated PHP and tried to update to 3.0 and 3.0 dev, but seems like another issue has occurred with bibcite.

  • 🇵🇹Portugal rfmarcelino

    You need to run a drush updb or visit /update.php after upgrading.

  • I have ran drush updb already and it said no pending updates, but when I try to rebuild cache I get this error:

    PHP Fatal error:  Declaration of Drupal\bibcite_entity\Normalizer\CslReferenceNormalizer::supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool must be compatible with Drupal\serialization\Normalizer\NormalizerBase::supportsDenormalization($data, $type, $format = null) in /var/www/html/modules/contrib/bibcite/modules/bibcite_entity/src/Normalizer/CslReferenceNormalizer.php on line 28
     [warning] Drush command terminated abnormally.
  • 🇵🇹Portugal rfmarcelino

    Never saw that one :)
    I saw that you opened an issue in the bibcite project. Hope you manage to sort it out.

  • Actually, do you think #1 is caused by this during import?

    Warning: Undefined array key "doi" in Drupal\bibcite_import_orcid\Process->prepImportOrcid() (line 51 of /var/www/html/modules/contrib/bibcite_import_orcid/src/Process.php)
    
    #0 /var/www/html/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
    #1 /var/www/html/modules/contrib/bibcite_import_orcid/src/Process.php(51): _drupal_error_handler()
    #2 /var/www/html/modules/contrib/bibcite_import_orcid/bibcite_import_orcid.batch.inc(18): Drupal\bibcite_import_orcid\Process->prepImportOrcid()
    #3 /var/www/html/core/includes/batch.inc(295): bibcite_prep_import_orcid_batch()
    #4 /var/www/html/core/includes/batch.inc(137): _batch_process()
    #5 /var/www/html/core/includes/batch.inc(93): _batch_do()
    #6 /var/www/html/core/modules/system/src/Controller/BatchController.php(55): _batch_page()
    #7 [internal function]: Drupal\system\Controller\BatchController->batchPage()
    #8 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
    #9 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #10 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
    #11 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
    #12 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #13 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #14 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
    #15 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #16 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #17 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #18 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #19 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #20 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #21 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
    #22 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle()
    #23 {main}
    

    .

  • 🇵🇹Portugal rfmarcelino

    That's a warning that the DOI is not available in the user profile.

    To debug, you can create a reference in the UI and try to view it. I the problem persists, then has nothing to do with the import from ORCID.

Production build 0.71.5 2024