I get this error when I pull up a page with facebook status page on my site?

warning: array_unique() [function.array-unique]: The argument should be an array in /var/www/vhosts/mysite.com/httpdocs/drupal/sites/all/modules/facebook_status/facebook_status.module on line 1001.

any ideas on what is going on?

Thanks.

Comments

icecreamyou’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

What version and type of SQL are you using?

Anyway, this shouldn't happen on any page, just with pages that have the FBS UR block.

socialnicheguru’s picture

MySQL database 5.0.22
MySQL database for event module 5.0.22
PHP 5.2.6
PHP register globals Disabled
SimpleXML library. Available
A fast XML parsing library. (From PHP5)
Unicode library PHP Mbstring Extension
Web server Apache/2.2.3 (CentOS)
jQuery UI 1.5.2
jQuery Update Installed correctly

icecreamyou’s picture

Hmm. I would have expected MySQL 4.x. Is your site on a subdomain? Do you have User Relationships installed? Is this error in the logs or is it a WSOD? Which blocks are you looking at and what are the FBS permissions of the users looking at them that cause these errors?

socialnicheguru’s picture

it is in a subdirectory.
i do have user relationships installed
it is not wsod, but an onscreen error
i have just installed to test. it is for admin, user 1

; Information added by drupal.org packaging script on 2009-01-15
version = "5.x-2.x-dev"
project = "user_relationships"
datestamp = "1231978884"

icecreamyou’s picture

The likely culprit for this type of issue is a spelling error in a variable, but as far as I can tell there aren't any spelling errors in the relevant locations. Perhaps try removing the comment on line 1001, or looking around there to see if you notice any mismatched variable names that I didn't. Otherwise, I have no idea, and I would expect to have seen a lot more people with this error if I this was the case.

socialnicheguru’s picture

I just tried to test (albeit I am not a programmer but i can throw in a few print statements to see what is going on. Hopefully this diagnostic will help).

I put this in the code to see what was going on:

// TEST AND DEBUG
print '<br>$user_rel is'.$user_rel;
$row = db_fetch_array($user_rel);
print '<br> $row is'. $row;

      while ($row = db_fetch_array($user_rel)) {
        //Don't include current user.

// TEST AND DEBUG
print '<br> $row[uid] is '.$row['uid'];
        if ($row['uid'] != $user->uid) {
          $uid_list[] = $row['uid'];
        }
      }
    }
// TEST	AND DEBUG
print '<br>$uid_list is '.$uid_list;
    $uid_list = array_unique($uid_list);

the out put was:

$user_rel isResource id #3964
$row is
$user_rel isResource id #3966
$row is
$user_rel isResource id #3968
$row is
$user_rel isResource id #3970
$row is
$uid_list is

It doesn't seem that $row is defined (but that could be my lack of knowledge of db_fetch_array if it is given a resource id).
http://api.drupal.org/api/function/db_fetch_array/6

It doesn't look like the while loop is being executed. Then what is passed into array_unique is not an array because it has not been defined.

socialnicheguru’s picture

I also notice that I have Facebook Status UR Recent Updates block and other blocks enabled. The UR Recent Updates block show my own status updates. I bring this up, because in the code around line 1001 ie the while loop above, it says that it wants to exclude the current signed in user.

I am the admin and have not created any user relationships yet.

socialnicheguru’s picture

Lastly, when I do try to run the status, I do get the status update (with additional unexpected updated as in #7). I also get these errors:

Hi when I implemented a status update, I got the following errors.

I include the activity module errors because I think has something to do with facebook_status interaction with activity module. I am running activity 5.x-4.x-dev, which they suggest.

* warning: Missing argument 6 for activity_insert(), called in /var/www/vhosts/beta.activelyOUT.com/httpdocs/drupal/sites/all/modules/facebook_status/facebook_status.module on line 1117 and defined in /var/www/vhosts/beta.com/httpdocs/drupal/sites/all/modules/activity/activity.module on line 391.
* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /var/www/vhosts/beta.com/httpdocs/drupal/includes/database.mysql.inc on line 402.
* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /var/www/vhosts/beta.com/httpdocs/drupal/includes/database.mysql.inc on line 402.
* warning: Invalid argument supplied for foreach() in /var/www/vhosts/beta.com/httpdocs/drupal/sites/all/modules/activity/activity.module on line 403.
* warning: array_unique() [function.array-unique]: The argument should be an array in /var/www/vhosts/beta.com/httpdocs/drupal/sites/all/modules/facebook_status/facebook_status.module on line 1001.

I hope I am being helpful in trying to point out some items and trying to do limited testing so you don't have too.

C

icecreamyou’s picture

Status: Postponed (maintainer needs more info) » Needs review

Thank you for trying to debug. First and foremost, the project page says:

Activity integration (3.x branch; 5.x-4.x and 6.x-1.x will only be supported after those branches have a supported release)

So, don't use Activity 4.x. I've had a couple of these reports; I should probably just add an error to the module if I can figure out a way to detect what Activity version is being used...

Second, you're getting the error because you don't have any relationships. If you don't have any relationships, the FBS UR block will show your latest status instead. I think all you need to do to fix this error is add this line after line 964:

  $uid_list = array();

The problem was that $uid_list was not initiated as an array before it was run through array_unique() unless the relevant user had relationships already.

For future reference, with regards to the code you used to test:

//Add a space between the period and the variable.  Also db_query() returns Database Resource IDs which are completely useless in most cases until you pass them to a function that knows what they are.
print '<br>$user_rel is'.$user_rel;
//This removes a row from the result and stores it in array $row with keys as the column names.  $user_rel is a Database Resource ID and after this line is run will reference one row less than it did before the line was run.
$row = db_fetch_array($user_rel);
//If you want to know what's in $row and it's not a number or string, use print_r($row) or var_dump($row).  It's a good idea to wrap that in <pre> tags so you can see the structure visually: echo '<pre>'. var_dump($row) .'</pre>';
print '<br> $row is'. $row;
icecreamyou’s picture

Status: Needs review » Fixed

I think this is fixed locally. It will be in the next release. Please reopen the issue if it is not fixed.

Status: Fixed » Closed (fixed)

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