warning: Invalid argument supplied for foreach() in
/modules/dcl_importer/ic_wrapper.inc on line 37.

Gmail login information is invalid or your contact list is empty, if you are sure that your contact list is not empty then please try again and make sure that you have typed the correct login information.

my login is fine and i do have some contacts. any ideas why it breaks?

Comments

soosa’s picture

Status: Active » Closed (won't fix)

I can't reproduce the issue, i have tried it with 4 different gmail accounts and it worked just fine!

snookie’s picture

OK, is anyone else having a problem with it then?

I've got:

Token 5.x-1.9
Invite 5.x-1.12

soosa’s picture

Status: Closed (won't fix) » Active

I am not really sure, no one reported this issue after a critical bug fix in Gmail importer!
can you please try using it with a different browser other than the one you are currently using and tell me what you get, i am suspecting that its a matter of cache or something, please try it and post what you get.

ragaskar’s picture

This is a verified bug -- I got this when I installed on my dev server.

The error that is thrown is an issue with the dcl_wrapper code; whenever you recurse through a var using foreach you must verify that it is a non-empty array. In the dcl_wrapper.inc, the importGmail function should be changed to check that $snapshot->contacts is non-empty, like so:

function importGmail($login, $password) {
    include ('scripts/importGmail.class.php');
    global $names;
    global $emails;
    $gmailer = new GMailer();
    if($gmailer->created) {
      $gmailer->setLoginInfo($login, $password, $my_timezone, 0);
      //if you are using a proxy then uncomment the following single line and modify it according to your settings.
      //$gmailer->setProxy("proxy.company.com");
      if($gmailer->connect()) {
        $gmailer->fetchBox(GM_CONTACT, 'all', '');
        $snapshot = $gmailer->getSnapshot(GM_CONTACT);
        if (!empty($snapshot->contacts)) {
        foreach($snapshot->contacts as $key => $value) {
          $names[] = $value['name'];
          $emails[]= $value['email'];
        }
        }
      }
    }
   return array($names, $emails);
  }

More importantly, I haven't found WHY the libg110 error is getting thrown (basically, instead of getting the contacts, my login is getting redirected) -- the discussion on the libgmailer (btw, you might want to check that your redistribution of libgmailer.php as importGmail.php is in line with GPL licensing restrictions) forum shows that this is a pretty general error, so it's hard to tell what's happening with my server. They have a diagnose.php script which my failing server passes with no problem (and it works on my live server, so I'm not sure it's worth my debugging time).

soosa’s picture

i was able to reproduce this issue and i will fix this very soon :-)

soosa’s picture

Assigned: Unassigned » soosa
Anonymous’s picture

+1 Tracking

soosa’s picture

Thanks for the very nice hint ragaskar :-)
much appreciated!

soosa’s picture

Status: Active » Fixed
nitin4php’s picture

Even I m getting issue with Gmail Importer.

I am logged out of Drupal setup.

Thanks in advance.

mssarath’s picture

I am getting the same , i will be get logged out aftter 3rd successive error tries

it seems like they are destroying $_SESSION variable, i think its in the importgmail.class.php as none of other class didn't reset it. hope it will get sorted soon

soosa’s picture

Regarding session destroy (Logging out!) , this issue has been fixed, so you may want to download a fresh tarball from the project page or you may want to change the value of the constant (GM_USE_LIB_AS_MODULE) from "FALSE" to "TRUE" in the file (modules/dcl_importer/scripts/importGmail.class.php) at line "17".

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

mandor78’s picture

i have same worning. i use the last version of module 10.01.08.

najibx’s picture

This is fixed with the Jan 12 release.