Error if adressed to someone who got deleted

culfin - October 27, 2009 - 13:07
Project:Privatemsg
Version:7.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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

#1

Berdir - October 28, 2009 - 17:30
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.

AttachmentSize
check_user_load.patch 961 bytes

#2

Berdir - October 29, 2009 - 23:25

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

Berdir - October 30, 2009 - 09:40

Second approach attached as a patch.

Maybe make this configurable?

AttachmentSize
check_user_load_continue.patch 922 bytes

#4

Berdir - October 31, 2009 - 12:16

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.

AttachmentSize
check_user_load_continue_with_test.patch 2 KB

#5

Berdir - November 1, 2009 - 23:08
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

System Message - November 15, 2009 - 23:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.