Warnings on reports page

Created on 14 June 2023, over 1 year ago
Updated 23 May 2024, 6 months ago
Warning: Undefined array key "node" in Drupal\entity_reports\ReportGenerator->generateEntityStatisticsReport() (line 323 of modules/contrib/entity_reports/src/ReportGenerator.php).
Drupal\entity_reports\ReportGenerator->generateEntityStatisticsReport('node', 'bio') (Line: 105)
Drupal\entity_reports\ReportGenerator->getEntityTypeStructure('node') (Line: 122)
Drupal\entity_reports\Controller\EntityReportsController->displayReport('node')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
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: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
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: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: Trying to access array offset on value of type null in Drupal\entity_reports\ReportGenerator->generateEntityStatisticsReport() (line 323 of modules/contrib/entity_reports/src/ReportGenerator.php).
Drupal\entity_reports\ReportGenerator->generateEntityStatisticsReport('node', 'bio') (Line: 105)
Drupal\entity_reports\ReportGenerator->getEntityTypeStructure('node') (Line: 122)
Drupal\entity_reports\Controller\EntityReportsController->displayReport('node')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
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: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
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: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine trishen Kharkiv

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

Comments & Activities

  • Issue created by @trishen
  • First commit to issue fork.
  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia jannakha Brisbane!

    Can you provide more information about your setup:
    Drupal version?
    What kind of content types exist on your installation? Any custom entities which are not nodes?

    The issue that is described above implies that there's a bundle which is not a node (but somehow it's was picked as a "node":

    $bundle_info = $this->entityTypeBundleInfo->getAllBundleInfo();
    $bundle_info = array_intersect_key($bundle_info, $entity_types); <- somehow bundle is returned for a 'node' but it's not a node.

    $info = $bundle_info[$entity_type][$bundle];

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

    I am also seeing similar, but also with an Error

    [Wed, 09/06/2023 - 09:43 EDT] [Warning] [php] [client: ::1, admin] Warning: Trying to access array offset on value of type null in Drupal\entity_reports\ReportGenerator->generateEntityStatisticsReport() (line 342 of /Applications/MAMP/htdocs/modules/contrib/entity_reports/src/ReportGenerator.php) #0 /Applications/MAMP/htdocs/core/includes/bootstrap.inc(164): _drupal_error_handler_real(2, 'Trying to acces...', '/Applications/M...', 342)\n#1 /Applications/MAMP/htdocs/modules/contrib/entity_reports/src/ReportGenerator.php(342): _drupal_error_handler(2, 'Trying to acces...', '/Applications/M...', 342)\n#2 /Applications/MAMP/htdocs/modules/contrib/entity_reports/src/ReportGenerator.php(105): Drupal\entity_reports\ReportGenerator->generateEntityStatisticsReport('group', 'learning_path')\n#3 /Applications/MAMP/htdocs/modules/contrib/entity_reports/src/Controller/EntityReportsController.php(341): Drupal\entity_reports\ReportGenerator->getEntityTypeStructure('group')\n#4 [internal function]: Drupal\entity_reports\Controller\EntityReportsController->exportStatisticsReport('xml')\n#5 /Applications/MAMP/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)\n#6 /Applications/MAMP/htdocs/core/lib/Drupal/Core/Render/Renderer.php(583): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()\n#7 /Applications/MAMP/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))\n#8 /Applications/MAMP/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)\n#9 /Applications/MAMP/htdocs/vendor/symfony/http-kernel/HttpKernel.php(182): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()\n#10 /Applications/MAMP/htdocs/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)\n#11 /Applications/MAMP/htdocs/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#12 /Applications/MAMP/htdocs/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#13 /Applications/MAMP/htdocs/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#14 /Applications/MAMP/htdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#15 /Applications/MAMP/htdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#16 /Applications/MAMP/htdocs/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#17 /Applications/MAMP/htdocs/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#18 /Applications/MAMP/htdocs/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#19 /Applications/MAMP/htdocs/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#20 /Applications/MAMP/htdocs/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)\n#21 /Applications/MAMP/htdocs/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))\n#22 {main}.
    [Wed, 09/06/2023 - 09:43 EDT] [Error] [php] [client: ::1, admin] TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in array_key_exists() (line 344 of /Applications/MAMP/htdocs/modules/contrib/entity_reports/src/ReportGenerator.php).

    entity_reports 2.0.1
    Drupal version : 10.1.2
    DB driver : pgsql
    PHP version : 8.1.0
    Drush version : 12.1.3.0

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

    I ended up patching it like this:

    --- a/modules/contrib/entity_reports/src/ReportGenerator.php
    +++ b/modules/contrib/entity_reports/src/ReportGenerator.php
    @@ -340,7 +340,7 @@ public function generateEntityStatisticsReport($entity_type, $bundle) {
         $row = [
           'label' => $info['label'],
           'id' => $bundle,
    -      'translatable' => array_key_exists('translatable', $info) && $info['translatable'] ? $this->t('True') : $this->t('False'),
    +      'translatable' => is_array($info) && array_key_exists('translatable', $info) ? $this->t('True') : $this->t('False'),
           'count' => $query->accessCheck(FALSE)->count()->execute(),
         ];

    My page http://local.local:8888/admin/reports/entity_statistics.xml is now loading

  • @trishen opened merge request.
  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine trishen Kharkiv
  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    This might be a different issue, but I'm getting this warning on the reports page. The patch didn't help so it seems like a similar issue in the same file.

    Warning: foreach() argument must be of type array|object, null given in Drupal\entity_reports\Controller\EntityReportsController->__construct() (line 81 of modules/contrib/entity_reports/src/Controller/EntityReportsController.php).

    The structure part for content types doesn't show anything.

  • Status changed to Needs work 6 months ago
  • πŸ‡¦πŸ‡ΊAustralia VladimirAus Brisbane, Australia

    As per #8.
    Can we add tests as well?

Production build 0.71.5 2024