Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP collection listing can be broken if a user is deleted #2398

Closed
jackmcdade opened this issue Sep 10, 2020 · 6 comments
Closed

CP collection listing can be broken if a user is deleted #2398

jackmcdade opened this issue Sep 10, 2020 · 6 comments

Comments

@jackmcdade
Copy link
Member

Bug Description

If you have a users field (e.g. author) and add it to your listing column for the collection, the listing will break if you delete a user that has been assigned to an entry.

You'll get a Call to member function id() on null error on the page.

Environment

Statamic version: 3.0.7

PHP version: 7.4

Install method (choose one):

  • Fresh install from statamic/statamic
@jackmcdade jackmcdade added the bug label Sep 10, 2020
@jetwes
Copy link

jetwes commented Sep 11, 2020

I have this behaviour on a complete fresh install. No user was deleted. If I click on collections in the cp I get this error.
The front is also broken - same error....

EDIT: Same on blueprints in the cp

PHP: 7.4.9

@duncanmcclean
Copy link
Member

What should happen instead if the user doesn't exist, should it just display as nothing? I'm thinking about creating a bug fix for this.

@jackmcdade
Copy link
Member Author

Yes it should just null out the author, and the next time the entry is saved it'll get removed from the data

@jackmcdade
Copy link
Member Author

My guess is the answer lies in here: https://github.com/statamic/cms/blob/master/src/Fieldtypes/Users.php#L68-L77

But i've been wrong many times before 😂

@duncanmcclean
Copy link
Member

Sweet, I'll have a look over the weekend 😃

@duncanmcclean
Copy link
Member

Fixed in db9968c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants