I'm getting the following warning on every page:

Warning: in_array() expects parameter 2 to be array, string given in fboauth_user_permissions() (line 365 of .../fboauth.fboauth.inc).

It's coming from a call I'm making to fboauth_action_display('connect') . And it's resulting from fboauth_user_permissions() receiving an argument that evaluates to the empty string, and therefore doesn't get caught as not set. I'm not sure how this is happening.

CommentFileSizeAuthor
#1 fboauth-profile_var-1638404-1.patch659 bytesgoron

Comments

goron’s picture

Title: Warning: in_array() expects parameter 2 to be array, string given in fboauth_user_permissions() » Saving config form results in an error and empty variable when no Profile fields exist.
Status: Active » Needs review
StatusFileSize
new659 bytes

Ok. This was a not-very-telling warning that was coming from a simple problem.

I have the profile module enabled, but no profile fields set up. This results in the following code saving a NULL value for the variable fboauth_user_profile, since in this case $form_state['values']['fboauth_user_profile'] is undefined:

/**
 * Submit handler for the Facebook OAuth settings form.
 */
function fboauth_profile_form_submit(&$form, &$form_state) {
  variable_set('fboauth_user_profile', array_filter($form_state['values']['fboauth_user_profile']));
}

This actually also results in an undefined index error when the form is saved, but I didn't notice it because I never saved that form on this site. I actually exported that variable to a feature using strongarm on another site and enabled that feature on this site. Strongarm exported the variable as the empty string, which led to the error mentioned in the first post.

The actual problem is that the submit callback doesn't check if any value actually exists for ['fboauth_user_profile']. Patch below fixes that.

silverbell’s picture

Thanks @goron. This patch fixed the error message on my site.

quicksketch’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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