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.

Files: 
CommentFileSizeAuthor
#9 ur-default-friend-delete-9.patch913 bytesBerdir
FAILED: [[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 ]
#8 ur-default-friend-delete-8.patch1.1 KBmrf
FAILED: [[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 ]
#6 ur-default-friend-delete.patch1.04 KBmrf
PASSED: [[SimpleTest]]: [MySQL] 995 pass(es).
[ View ]

Comments

glitz’s picture

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

Thanks!
Chris

mmachina’s picture

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

mrf’s picture

Component:Code» Defaults
mrf’s picture

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.

mrf’s picture

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

mrf’s picture

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
StatusFileSize
new1.04 KB
PASSED: [[SimpleTest]]: [MySQL] 995 pass(es).
[ View ]

And here's a version of this for d7.

Berdir’s picture

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

mrf’s picture

Status:Needs work» Needs review
StatusFileSize
new1.1 KB
FAILED: [[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 ]

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

Berdir’s picture

StatusFileSize
new913 bytes
FAILED: [[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 ]

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

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

mrf’s picture

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 :)

Berdir’s picture

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

mrf’s picture

Status:Patch (to be ported)» Fixed

Simplified version committed to 6.x

Status:Fixed» Closed (fixed)

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