Closed (fixed)
Project:
User Relationship Locator
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2012 at 06:18 UTC
Updated:
21 May 2012 at 16:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
danreb commentedchange issue title to easily track..
Comment #2
danreb commentedThis problem is not present in the dev version, thought it's already fixed... closing this one, my bad I didn't test the dev first. :)
Comment #3
olivier999 commentedGreat module.
However, this message is still present, even in the dev version.
Any idea would be welcome ;)
Comment #4
mrf commentedI think this error comes up when you don't have any relationship information to pass in, should be easy for me to include check for that, but just creating some dummy relationships between a couple of users should make it go away.
Comment #5
olivier999 commentedyour solution works but user can see himself and his relations in choice even if he has 3 actives relations.
Would it be possible not to show any results while there are not relevant ?
Comment #6
mrf commentedI just published an alpha2 that includes the single change for the issue you describe, its possible you were running off of an earlier dev, and the module was pretty useless without that fix.
Comment #7
olivier999 commentedThank you for the update : everything is working perfectly now.
Comment #8
mattsteven commentedDisregard my previous comment- I would report that this is regressed on my installation with 7.x-1.0-alpha2 and so it's not really fixed.
Warning: array_merge(): Argument #2 is not an array in user_relationship_locator_matches() (line 95 of sites/all/modules/user_relationship_locator/user_relationship_locator.api.inc).I can suppress it with changing to
$matches = (count($filler)) ? array_merge($matches,$filler) : $matches;But I think the root of the problem is that it doesn't work for very small sets. I have three users in my DB including admin, and verified they are stored in the user_relationship_locator table ( a:2:{i:6;s:1:"6";i:1;s:1:"1";} ) Not sure of the structure of this, but it looks like there are two elements in this array which should be enough to force a suggestion of the other user right?
Thanks for your work on this very useful module!
Comment #9
mattsteven commentedHere's a patch, but I don't want to suggest anyone use it just yet. It seems to get it working right for me, but look at the line 95 test condition because it seems backward to me at the moment even if it works.
I think the problem was that php's array_rand function returns a string not an Array when there's less than two values. Bad design on their part, but you have to make room for the exception.
Comment #10
mrf commentedCan you let me know what version of PHP you are using? I'm not able to recreate this error and I have a suspicion the behavior of array_rand might have been fixed in my version.
I committed a fix for the db_query you caught, I'd recommend in the future you use drupal's api rather than string concatenation, it protects you from all sorts of security vulnerabilities. http://api.drupal.org/api/drupal/includes--database--database.inc/functi...
Comment #11
mattsteven commentedThanks for the quick reply, and advice on queries. I forgot I included that quick fix when posting. =)
Here's my version, it's the standard php included in ubuntu 11.10, so if you grab a VM of that you can probably get pretty close to what I'm doing.
PHP 5.3.6-13ubuntu3.3 with Suhosin-Patch (cli) (built: Dec 13 2011 18:18:37)
Comment #12
mrf commentedOk, I'm running the same version of PHP, so no help there.
Maybe you could get me the exact combination of users and releationships you are experiencing this with? I didn't see this with only one active relationship between the two users on the site.
Comment #13
mrf commentedClosed #1469118: User relationship locator configuration as a duplicate, but I now have a new test case from there to run with.
Comment #14
mrf commentedFixed in http://drupalcode.org/project/user_relationship_locator.git/commitdiff/0....
Please try out the latest dev and let me know if this is working for you.
Thanks mattsteven for the patch, realized after I worked on this for a while you were handing me the answer but I was too dense to see it. :)
Comment #15
mrf commentedComment #17
jibranWhen the user have no friend I am getting this error.
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in user_relationship_locator_matches() (line 116 of sites/all/modules/user_relationship_locator/user_relationship_locator.api.inc).Minimum number of matches to return is 3.
Maximum number of matches to return is 5.
Depth to search for relationship matches 1.
I have updated it with latest dev version but error is still occurring.
Comment #18
jibranCan someone respond to this?
Comment #19
mrf commentedJust pushed another change to dev that should cover your example, please let me know if it resolves your issue.
Comment #20
mrf commented