Using:
FLV Media Player 5.x-4.0-alpha9
XSPF Playlist 5.x-1.20-alpha3

If I go to edit a content that has xspf playlist enabled, I see these two errors show up:

* warning: Invalid argument supplied for foreach() in /srv/www/targetmultimedia/sites/all/modules/xspf_playlist/xspf_playlist_node/xspf_playlist_node.module on line 637.
* warning: preg_match() expects parameter 2 to be string, array given in /srv/www/targetmultimedia/includes/bootstrap.inc on line 684.

This is the function where foreach loop is:

/**
 * build a list of the thumbnails, filter
 *
 * @param object $node drupal node object
 * @param array $filter sets the file types
 * @return array
 */
function xspf_playlist_node_thumbs($node, $filter = array('jpeg', 'jpg', 'gif', 'png')) {
  // get all the thumbnails for this node
  $all_thumbs = xspf_playlist_node_thumb_get_all($node, true);
  $i = 1;
  // now filter out the thumbs that we can't use
  foreach ($all_thumbs as $id => $thumb) {
    $pathinfo = pathinfo($thumb);
    if (in_array($pathinfo['extension'], $filter)) {
      $thumbs[$i] = $thumb;
      $i++;
    }
  }
  // add a default option
  $thumbs[0] = t('Default');

  return $thumbs;
}

Note that we have setup the default thumbnails to none. Perhaps we need to check wether $all_thumbs has anything in it before looping it? im not a dev sorry :X

-let me know if you need more info -- the player is NOT showing up at all at the moment.

Comments

Manuel Garcia’s picture

Some more information:

The error above appears even if going to the node add page, /node/add/video for example. So it doesn't have to do with having any files uploaded yet.

Manuel Garcia’s picture

More info, here's what I've tried:

I used the function below instead of the original in xspf_playlist_node.module, basically checking that $all_thumbs is not empty before looping it,

/**
 * build a list of the thumbnails, filter
 *
 * @param object $node drupal node object
 * @param array $filter sets the file types
 * @return array
 */
function xspf_playlist_node_thumbs($node, $filter = array('jpeg', 'jpg', 'gif', 'png')) {
  // get all the thumbnails for this node
  $all_thumbs = xspf_playlist_node_thumb_get_all($node, true);
  $i = 1;
  // now filter out the thumbs that we can't use
  if (!empty($all_thumbs)){
    foreach ($all_thumbs as $id => $thumb) {
      $pathinfo = pathinfo($thumb);
      if (in_array($pathinfo['extension'], $filter)) {
        $thumbs[$i] = $thumb;
        $i++;
      }
    }
  }
  // add a default option
  $thumbs[0] = t('Default');

  return $thumbs;
}

This results in the first error not showing up , but the second one, still appearing:

warning: preg_match() expects parameter 2 to be string, array given in /srv/www/targetmultimedia/includes/bootstrap.inc on line 684.

Hope this helps, but right now I am kinda lost on what could be going on here.

Any pointers?

ranavaibhav’s picture

I have exact same configuration and receiving same errors.. Please help!!
Thank you...

gggdrpl’s picture

Same problem using:

FLV Media Player 5.x-4.0-beta1
XSPF Playlist 5.x-1.20-alpha3

Any clue, please? Thanks!

arthurf’s picture

The fix for the foreach is in cvs, looking into the pregmatch issue.

arthurf’s picture

warning: preg_match() expects parameter 2 to be string, array given in /srv/www/targetmultimedia/includes/bootstrap.inc on line 684.

Fix for this is in CVS