Problem/Motivation

Opening a node with no existing user assigned results in a fatal error.

Steps to reproduce:
1. Create a node with a user assigned.
2. Remove the user.
3. Go back to the node.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

sasanikolic created an issue. See original summary.

longwave’s picture

How did you perform step 2? When you cancel an account you are given four options:

  • Disable the account and keep its content.
  • Disable the account and unpublish its content.
  • Delete the account and make its content belong to the Anonymous user.
  • Delete the account and its content.

So what should happen is either the account will still exist (first two options), the content should belong the the anonymous user (third option), or the content will no longer exist (fourth option).

Also, what was the fatal error message you saw?

sasanikolic’s picture

Status: Active » Needs review
StatusFileSize
new164.06 KB
new326.42 KB
new704 bytes

I know, I tried reproducing it through UI, and saw those options.
I deleted the user via SQL query, without deleting it's referenced content. Solved the first error with a simple

 if ($node->getOwner()) { ... },

but then there is another error in seven.theme when editing the node without a user. See the attached images.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

merilainen’s picture

Status: Needs review » Closed (works as designed)

I think this works as designed. If you do custom SQL queries and manage to get Drupal into a state where it gives you an error, then you can also implement custom code in hook_preprocess_node to handle that error. Unless you can make that error happen without custom code, then this works as designed.