Download & Extend

Errors when default friend deleted

Project:User Relationships
Version:6.x-1.x-dev
Component:Defaults
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi,

I'm currently using the 6.x-1.x-dev version with Drupal 6.16 and as admin when I delete a user from the Default relationships list the below error pops up.

"recoverable fatal error: Object of class stdClass could not be converted to string in /home/.../sites/all/modules/user_relationships/user_relationship_defaults/user_relationship_defaults.module on line 194."

Tried a complete wipe of all UR tables and reinstall of the module but still happens. If I remember correctly this didn't happen when using 6.x-1.0-rc3

If doesn't seem a serious error as I can still proceed past it but still a little disconcerting to see it.

Comments

#1

any update on how this was fixed? This is happening to me as well, only when adding a friend (relationship)

Thanks!
Chris

#2

getting the same error when deleting a default friend...

#3

Component:Code» Defaults

#4

Status:active» closed (cannot reproduce)

I just:
Set up a default user.
Created 50 users who have a relationshiip with this user.
Deleted the default user.

No error messages on relationship or user pages, think this one must have been fixed along the way.

#5

After going back to the UR admin page I noticed some notices caused by my tests for this, but no fatal error.

Committed a fix to ur defaults hook_user that now deletes the default entry when a user is deleted and should prevent any future issues like the above from occurring.

http://drupalcode.org/project/user_relationships.git/blobdiff/0c49e3f0df...

#6

Title:Deleting a Default Friend causes "recoverable fatal error:..."» Errors when default friend deleted
Version:6.x-1.x-dev» 7.x-1.x-dev
Status:closed (cannot reproduce)» needs review

And here's a version of this for d7.

AttachmentSizeStatusTest resultOperations
ur-default-friend-delete.patch1.04 KBIdlePASSED: [[SimpleTest]]: [MySQL] 995 pass(es).View details

#7

Status:needs review» needs work

+++ b/user_relationship_defaults/user_relationship_defaults.module
@@ -246,6 +246,20 @@ function user_relationship_defaults_user_update(&$edit, $account) {
+    $defaults = db_query("SELECT uid FROM user_relationship_defaults")->fetchAssoc();
+    if ($default->uid == $account->uid)  {
+      db_delete('user_relationship_defaults')
+        ->condition('uid', $default->uid)
+        ->execute();
+    }

That condition makes no sense :) fetchAssoc() returns an array then you're using it as an object.

Just do the db_delete(), if there is something to delete, it will delete and if the condition doesn't match anything, nothing happens...

#8

Status:needs work» needs review

And an actual tested working version of the patch. Failed mental transition between 6 and 7 :)

AttachmentSizeStatusTest resultOperations
ur-default-friend-delete-8.patch1.1 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch ur-default-friend-delete-8.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details

#9

I'm not sure why it needs to be so complicated?

Why not simply do it as I did in my patch?

AttachmentSizeStatusTest resultOperations
ur-default-friend-delete-9.patch913 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch ur-default-friend-delete-9.patch. Unable to apply patch. See the log in the details link for more information.View details

#10

Status:needs review» reviewed & tested by the community

Ahhhh the magic of dbtng I stared at that one for a while trying to figure out what you meant by "just do db_delete()" and fell back to my version after wiping out all my defaults :)

#11

Version:7.x-1.x-dev» 6.x-1.x-dev
Status:reviewed & tested by the community» patch (to be ported)

Commited, not sure what the testbot i waiting for.

Giving this one back to you, you might wanna simplify your code...

#12

Status:patch (to be ported)» fixed

Simplified version committed to 6.x

#13

Status:fixed» closed (fixed)

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

nobody click here