Download & Extend

Error if adressed to someone who got deleted

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

Status:active» needs review

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.

AttachmentSizeStatusTest resultOperations
check_user_load.patch961 bytesIgnored: Check issue status.NoneNone

#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?

AttachmentSizeStatusTest resultOperations
check_user_load_continue.patch0 bytesIgnored: Check issue status.NoneNone
check_user_load_continue.patch922 bytesIgnored: Check issue status.NoneNone

#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.

AttachmentSizeStatusTest resultOperations
check_user_load_continue_with_test.patch2 KBIgnored: Check issue status.NoneNone

#5

Version:6.x-1.0-rc4» 7.x-1.x-dev
Status:needs review» fixed

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

Status:fixed» closed (fixed)

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