Details
Type php
Message preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/picture2/pingiz.com/includes/bootstrap.inc on line 737.
Severity error

Comments

icecreamyou’s picture

Assigned: Unassigned » icecreamyou

What version of Drupal are you using? What version of PHP? What kind of SQL? What version of SQL? Parent domain or subdomain? What pages are you having this problem on, and what users encounter this problem?

For starters, don't enable the block for anonymous users.

icecreamyou’s picture

Status: Active » Postponed (maintainer needs more info)
volkiz’s picture

drupal 6.x
php5
mysql 5
parent domain
problem encountring on every pages have "facebook status" block
and problem started on when i update this module to 6.x-1.x-dev (2008-11-06) version

icecreamyou’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

I can't duplicate the issue. What are your settings for the module?

And do you have the Advanced Forum module enabled?

akashihi’s picture

I have same problem with same setup as volkiz has. No Advanced Forum module is installed. The settings are:
Facebook mode - on
Slide effect - on
Status length - 30/192/192
Number of statuses - 5
Misc - 0/0/Nothing

icecreamyou’s picture

Hmm... I can't figure out why this is happening, I can't duplicate the issue, and I can't think of anything else to debug...

It's possible I suppose that the problem has to do with the function names. The name of the form that appears in the facebook status block is facebook_status_update_form, and the name of the function that renders that form is facebook_status_display_form. Drupal has a hook_form, so it may be improperly trying to interpret those two functions using the hook_form structure. I think this could be the issue mainly because the error is appearing in bootstrap, which is when all the functions are loaded.

Which is to say, I've changed the names of those two functions and committed it to CVS. Try the next -dev and see if you still have the problem.

akashihi’s picture

I've looked into the bootstrap inc and found, that the error is in drupal_validate_utf8, which is called by .... check_plain :) and your module calls check_plain several times. I have spent some time, trying to find the erroneous cal, but didn't found anything, but i didn't checked every call

icecreamyou’s picture

If you're right, then the problem is probably either in facebook_status_display_form (now facebook_status_display_b):

  if (arg(0) == 'user' && is_numeric(arg(1)) && !$uid) {
    $account2 = user_load(array('uid' => arg(1)));
    $fbs_name = check_plain($account2->name);
    $fbs_uid = arg(1);
    $sm = db_fetch_array(db_query_range("SELECT status_fb, status_time FROM {facebook_status} WHERE uid = %d ORDER BY sid DESC", arg(1), 0, 1));
  }
  else if (arg(0) == 'node' && is_numeric(arg(1)) && !$uid) {
    $fbs_uid = db_result(db_query("SELECT uid FROM {node} WHERE nid = %d", arg(1)));
    $account2 = user_load(array('uid' => $fbs_uid));
    $fbs_name = check_plain($account2->name);
    $sm = db_fetch_array(db_query_range("SELECT status_fb, status_time FROM {facebook_status} WHERE uid = %d ORDER BY sid DESC", $fbs_uid, 0, 1));
  }
  else {
    $fbs_name = check_plain($account->name);
    $fbs_uid = $account->uid;
    $sm = db_fetch_array(db_query_range("SELECT status_fb, status_time FROM {facebook_status} WHERE uid = %d ORDER BY sid DESC", $account->uid, 0, 1));
  }

...or in facebook_status_update_form (now facebook_status_update):

    if (arg(0) == 'user' && is_numeric(arg(1)) && !$uid) {
      $user2 = user_load(array('uid' => arg(1)));
      $xname = check_plain($user2->name);
    }
    else if (arg(0) == 'node' && is_numeric(arg(1)) && !$uid) {
      $uuid = db_result(db_query("SELECT uid FROM {node} WHERE nid = %d", arg(1)));
      $user2 = user_load(array('uid' => $uuid));
      $xname = check_plain($user2->name);
      if ($uuid != $user->uid) {
        $xname = theme_username($user2);
      }
    }
    else if (!$uid) {
      $xname = check_plain($user->name);
    }
    else {
      $xname = theme_username($user);
    }

...but frankly, I don't see a problem, and it may be that there are other issues with your installation that are causing this problem. Certainly check_plain() is not a place I would expect a problem. More confusing to me, though, is that I don't think I changed/added/removed any check_plain() calls in the last -dev, which was when this problem started happening.

icecreamyou’s picture

Update: problem confirmed. Your setups probably have PHP compiled in a way that creates a WSOD on minor errors; I forget what that's called. On my system it just logs the error.

Flying Drupalist’s picture

Hi, does this mean I have to change my theme edits and blocks before I update?

icecreamyou’s picture

Yes... although it was kind of a stupid choice for me to rename those functions since it didn't actually solve anything. Sorry for the hassle.

akashihi’s picture

I'm using PHP package the from Debian stable

volkiz’s picture

installed dev update and nothings changed

icecreamyou’s picture

Priority: Normal » Critical

Yeah, I didn't really expect it to. Well, I'll go through the changes I made line by line as soon as I can and see if I can isolate the problem.

icecreamyou’s picture

I think I've figured out the problem.

In the November 6 update, I added a parameter for two forms to take. In 6.x, the first parameter must always be $form_state, but I didn't know that. So when I was trying to pass in a UID, it got overwritten when the form was built, and that left functions further down the line feeling the pain.

I'll try to fix it tonight, if not hopefully I'll get to it tomorrow. Looks like I should have taken a closer look here before even upgrading this module to 6.x - that'll teach me not to rely on coder.module. :-P

icecreamyou’s picture

Status: Postponed (maintainer needs more info) » Fixed

Fixed! (in the next -dev)

If you're calling facebook_status_display_b, you must now call it with two parameters: $form_state and $uid, in that order. If you don't know FAPI well (or even if you do and you don't have any special requirements), just pass NULL for $form_state.

Most people, of course, will not need to use the API, and the module should "just work."

akashihi’s picture

I confirm - everything is ok now

wotipka’s picture

Getting the same error:
preg_match() expects parameter 2 to be string, array given in /var/www/includes/bootstrap.inc on line 737

Currently trying to get dashPlayer installed and running. I cannot give you any more specifics other then:

All items latest as of 11/10/08
Drupal 6
PHP5

Edit: 11/14/08 00:28

I seem to not be getting connectivity between the dashPlayer and Drupal. (The player skin is there but the video never loads.) The error happens when I try to force the player to play. I guess because since it is not connecting to the "server" correctly that something is getting a null value.

SIDE NOTE: The whole nesting issue seems to be one of the most confusing points of Drupal. When you have to add content inside a module. For example /http://somewebsite.com/modules/fancymodule/fancymodule/stuff here. Now do you uncompress the folder and put the contents here or do you uncompress the folder and put the UNCOMPRESSED folder (making the contents one more level down) here. Most of the issues I have seem to come from this. A lot of docs say one thing and the config files are coded a different way. Can someone shed any light on this for us newbies?

icecreamyou’s picture

Status: Fixed » Closed (fixed)

wotipka, it seems that your issue is with dashPlayer and has nothing to do with facebook_status. Please open an issue under the correct project.