Posted by culfin on October 27, 2009 at 1:07pm
| Project: | Privatemsg |
| Version: | 7.x-1.x-dev |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
If you look at a message adressed to someone who got deleted from the database, privatemsg shows the following error:
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /var/www/html/sites/all/modules/imagecache_profiles/imagecache_profiles.module on line 41
Comments
#1
While the actual error does not happen inside privatemsg.module, it does also trigger a few notices that *are* inside our code :)
Fixed by checking the return value of user_load() and loading the anon user when FALSE is returned.
See also #559180: Delete messages and settings when a user is deleted. which does delete messages, tags and settings when a user gets deleted.
#2
Question: What should happen in that case?
1. Display the message as sent be Anonymous
2. Don't load/display the message when the author has been deleted/can't be found.
While the patch currently implements 1, I think 2 is probably better and also makes more sense together with #559180: Delete messages and settings when a user is deleted.
Opinions?
#3
Second approach attached as a patch.
Maybe make this configurable?
#4
I think solution 2 is the way to go for now, since we currently disallow anonymous users to send messages. We can revisit this once if we implement anonymous user access.
I will commit this soon unless someone finds a bug.
#5
I discussed this with nbz and changed my opinion. While maybe not right now, solution 1 makes more sense together with the mentioned patch, since something weird probably happened because the other patch is supposed to delete messages when users are deleted (not yet, since it hasn't been commited, of course).
Commited the patch in #1.
#6
Automatically closed -- issue fixed for 2 weeks with no activity.