Problem/Motivation

TypeError: Argument 1 passed to Drupal\Core\Entity\EntityViewBuilder::view() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in core/modules/node/node.module on line 559

Issue fork drupal-3278883

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vhin0210 created an issue. See original summary.

vhin0210’s picture

Status: Active » Needs review
larowlan’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Bug Smash Initiative, +Needs steps to reproduce

This shouldn't happen, as the author field has a default value.

Can you provide steps to reproduce this starting from 'install drupal'

Thanks

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

longwave’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community
Issue tags: -Needs steps to reproduce

Ran into this on an existing large site; this was a database integrity issue for me. Some nodes were somehow owned by deleted users, when rendering them in a search result I saw the same error.

> \Drupal\node\Entity\Node::load(71137)->getOwner();
= null

As getOwner() can return NULL (even though it is not documented as such) I think we should provide protection against this.

longwave’s picture

This also reminds me that all these historic theme settings should just be configured in the entity display.

  • catch committed d0144731 on 10.1.x
    Issue #3278883 by vhin0210, longwave: TypeError: Argument 1 passed to...

  • catch committed dd664245 on 11.x
    Issue #3278883 by vhin0210, longwave: TypeError: Argument 1 passed to...

  • catch committed eaa910de on 9.5.x
    Issue #3278883 by vhin0210, longwave: TypeError: Argument 1 passed to...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Seems OK to be more defensive here, there are other ways to find out the node owner has been deleted that aren't fatal errors for site visitors.

Committed/pushed to 11.x and cherry-picked back through to 9.5.x, thanks!

  • catch committed cb055605 on 10.0.x
    Issue #3278883 by vhin0210, longwave: TypeError: Argument 1 passed to...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.