Views TranslationLanguageRenderer fails on ghost nodes

Created on 13 April 2017, over 7 years ago
Updated 25 April 2024, 7 months ago

When moving a site form one environment to another have noticed that some "ghost nodes" are throwing an error in views. This prevents other processes such as indexing a site using modules like search_api_solr.

Repeatable: Sometimes??

Steps to repeat:
1. Try to index a site with a null entity object in the results.

Expected Results:

Views should detect null on prerender and render methods in views/src/Entity/Render/TranslationLanguageRenderer.php and not make method calls on non entity object

Actual Results:
Processing of results is completely halted and error is thrown:

Error: Call to undefined method stdClass::id() in Drupal\views\Entity\Render\TranslationLanguageRenderer->preRender() (line 51 of core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php)

If this is circumvented then another error is thrown in the render method on $entity_id = $row->_entity->id();

Have applied fix to make sure that the rows contain valid entity objects.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 24 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom richdykins

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • πŸ‡·πŸ‡΄Romania adevms

    Patch #3 worked for me. Using Drupal 9.5.10
    After bulk deleting nodes from the admin/content page, the db got corrupted, eg. the row from node table got deleted but in some other tables not(like node_field_data). Then on listings pages views errored in WOD with:

    Error: Attempt to assign property "view" on null in Drupal\views\Entity\Render\TranslationLanguageRenderer->preRender() (line 87 of /var/www/html/web/core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php)

    The patch from Multiple usages of FieldPluginBase::getEntity do not check for NULL, leading to WSOD πŸ› Multiple usages of FieldPluginBase::getEntity do not check for NULL, leading to WSOD Fixed helped on the admin/content page and patch #3 helped on user listing pages.

    Thank you for the patch.

  • last update over 1 year ago
    Patch Failed to Apply
  • πŸ‡¬πŸ‡§United Kingdom kenorb

    Same error:

    PHP message: Error: Attempt to assign property "view" on null in /var/www/html/web/core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php on line 87 #0 /var/www/html/web/core/modules/views/src/Plugin/views/row/EntityRow.php(221): Drupal\views\Entity\Render\TranslationLanguageRenderer->preRender(Array)
    #1 /var/www/html/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(444): Drupal\views\Plugin\views\row\EntityRow->preRender(Array)
    #2 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1513): Drupal\views\Plugin\views\style\StylePluginBase->preRender(Array)
    #3 /var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2459): Drupal\views\ViewExecutable->render()
    #4 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1667): Drupal\views\Plugin\views\display\DisplayPluginBase->preview()
    #5 /var/www/html/web/core/modules/views_ui/src/ViewUI.php(611): Drupal\views\ViewExecutable->preview('page_1', Array)
    

    while using Views with CiviCRM entities.

    The patch from #3 worked for Drupal 9.5.11.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Hitting this on a site that's using Entity Language Fallback β†’ .

  • Status changed to Needs review 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Rerolled.

  • Status changed to Needs work 7 months ago
  • The Needs Review Queue Bot β†’ tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request β†’ . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

Production build 0.71.5 2024