Hey populist-

I just discovered an error in my registration page that has something to do with the Firefox module. There error is:

warning: Invalid argument supplied for foreach() in /homepages/26/d92507165/htdocs/mcerdadomain/sites/all/modules/drupalforfirebug/drupalforfirebug.module on line 421.

Does this make any sense to you?

Thanks!

Comments

agentrickard’s picture

// Function to Convert Objects to Arrays
function objectToArray($object) {
  $array=array();
  foreach($object as $member=>$data) {
    $array[$member]=$data;
  }
  return $array;
}

Apparently $object is empty in this case. Use:

// Function to Convert Objects to Arrays
function objectToArray($object) {
  $array=array();
  if (empty($object)) {
    return $array;
  }
  foreach($object as $member=>$data) {
    $array[$member]=$data;
  }
  return $array;
}
agentrickard’s picture

Or just do:

// Function to Convert Objects to Arrays
function objectToArray($object) {
  return (array) $object;
}
tflmike’s picture

Status: Active » Fixed

agentrickard -

This works great! Thanks so much!

agentrickard’s picture

Status: Fixed » Needs review

We can't mark this as fixed until the code is committed.

populist’s picture

Status: Needs review » Fixed

objects are now converted to arrays using the power of (parentheses) as part of a larger refactoring and this will all be rolled into the next release

Anonymous’s picture

Status: Fixed » Closed (fixed)

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