
Hi.
When i am trying to import contact list from gmail i have this :
warning: Invalid argument supplied for foreach() in .....sites\all\modules\dcl_importer\dcl_wrapper.inc on line 40.
How can i fix it?
Comment | File | Size | Author |
---|---|---|---|
#28 | gdata-importer.patch | 5.7 KB | stashlbai |
Comments
Comment #1
soosa CreditAttribution: soosa commentedi will fix this very soon!
Comment #2
soosa CreditAttribution: soosa commentedFixed!, thanks for reporting.
Comment #3
mandor78 CreditAttribution: mandor78 commentedhow can i check it,i downloaded module today but its still not working...
Comment #4
soosa CreditAttribution: soosa commentedtry to download it again, most probably you have downloaded the out dated version! since generating tarballs in drupal project's page takes a while, so just try downloading it again!
Comment #5
mandor78 CreditAttribution: mandor78 commentednow i have this new warning:
warning: Invalid argument supplied for foreach() in ....\sites\all\modules\dcl_importer\dcl_wrapper.inc on line 49.
I think the bug only when the login name looks like fridman.vlad, if i use login looks like one word its working.
Comment #6
acushla CreditAttribution: acushla commentedHi,
I tried to install the module by taking the release that you have made on 17th January. But still I ma getting the error:
"warning: Invalid argument supplied for foreach() in mysitepath/drupal/modules/dcl_importer/dcl_wrapper.inc on line 49."
I am unable to import any contacts from gmail. Yahoo works fine. Please help!
Thanks in advance,
Rajat
Comment #7
solutiondrop CreditAttribution: solutiondrop commentedJust to confirm, I am also getting the same warning for gmail only using both single word email addresses and two word email addresses (e.g., first.second@gmail.com). I am running PHP5 and the lastest Drupal Dev version
"warning: Invalid argument supplied for foreach() in mysitepath/drupal/modules/dcl_importer/dcl_wrapper.inc on line 49."
Comment #8
soosa CreditAttribution: soosa commentedi really cannot reproduce this issue, i have tested gmail importer with 7 gmail accounts and they are all working just fine including accounts that start with (*.*) and single word accounts as well!
Comment #9
gs12345 CreditAttribution: gs12345 commentedI have downloaded the current stable tonight and can confirm that
modules/dcl_importer/dcl_wrapper.inc on line 49
happens with googlemail.com accounts with the form of "abc.abc"
I have over 1000 contacts though maybe that's also a problem?
Comment #10
R.Muilwijk CreditAttribution: R.Muilwijk commentedThe problem is that the function getAddressbook used in that line:
does not always return an array. There for it is not possible to do a foreach. The code should be something like:
Comment #11
xjs CreditAttribution: xjs commentedYes, this removes the warning. However, I am still getting this: "Gmail login information is invalid or your contact list is empty,..."
And my contact list is not empty. Anyone has the same problem?
Comment #12
Anonymous (not verified) CreditAttribution: Anonymous commented+1 I am also having this problem:
warning: Invalid argument supplied for foreach() in /home/cultural/public_html/sites/all/modules/dcl_importer/dcl_wrapper.inc on line 49.
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.
Comment #13
Walt Esquivel CreditAttribution: Walt Esquivel commentedI had the same exact problem as txcrew in #12 with the same exact error verbiage regarding the infamous line 49.
Although not all of my Gmail contacts have email addresses (some are just names with phone numbers and/or postal addresses), I have 963 contacts in my Gmail address book, so I know it's not empty. I tried getting this module to import both my Gmail and Yahoo contacts and both failed.
I'm on a shared host at DreamHost.
I'm using Drupal 5.7, Linux, Apache/2.0.61 (Unix), MySQL 5.0.24a, PHP 5.2.3, and dcl_importer-5.x-1.x-dev.
This issue seems to be a duplicate of http://drupal.org/node/209548, which is a line 49 error.
Comment #14
solutiondrop CreditAttribution: solutiondrop commentedMy problem is with gmail only, I have tested a yahoo.com account and that works fine.
Anyway, I did insert "error_reporting(E_ALL);" into the dcl_wrapper.inc file as suggested at http://drupal.org/node/209548. I did not get any PHP errors or notices in my error_log.
regarding troubleshooting the cookie directory as suggested at http://drupal.org/node/209548, the importGmail.class.php file doesn't seem to contain a $cookieFile or point to /var/tmp/ so I wasn't able to test for cookie directory problems for gmail, but at least I know that yahoo works so it probably isn't a problem with the cookie in my situation.
Thanks
Comment #15
xjs CreditAttribution: xjs commentedYes, yahoo works for me too, but not gmail. Haven't tested with others since I don't have account with them :)
Comment #16
soosa CreditAttribution: soosa commentedi suspect that the common factor between all the threads above is "the shared host", gmail importer is working perfectly with my installation and everything is just fine with the other importers, since its all working fine at least in my own server "i am running the importers in a dedicated server" then that would mean that there is something wrong "disabled/enabled" with the server configuration
if anyone has any clue why shared hosts doesn't work all the time with gmail specifically then i would thankful for any advice to be mentioned here.
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedI am on a dedicated server. But that is not to say I don't have something "disabled/enabled". But I don't know what that something could be.
txcrew
Comment #18
soosa CreditAttribution: soosa commentedcould you please post your php.ini settings so we can take a look at it?
Comment #19
xjs CreditAttribution: xjs commentedI have a local version which runs on my own server. My live version runs a VPS (php4). My local version has php 5 with mostly default setting except for:
;max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_execution_time = 1000 ; Maximum execution time of each script, in seconds
;max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
max_input_time = 1000 ; Maximum amount of time each script may spend parsing request data
memory_limit = 48M ; Maximum amount of memory a script may consume
Comment #20
solutiondrop CreditAttribution: solutiondrop commentedI'm also on a dedicated server, but like txcrew said above, I may have something "disabled/enabled". I'm using PHP Version 5.2.4.
Here is the PHP build information:
And here is my configuration:
Comment #21
Walt Esquivel CreditAttribution: Walt Esquivel commentedI came back here after having posted #13 above to see if this critical issue had been fixed, but it looks like both the critical issue described above and what appears to be its duplicate at http://drupal.org/node/209548 haven't been worked on since mid-February.
Is there anyone that can fix this critical issue and have the patch applied to the dev version so non-coders like me can easily download it?
Any assistance appreciated. Thank you. :)
Comment #22
sanoju CreditAttribution: sanoju commentedHi,
I've downloaded the module a couple days ago, and encountered the same "line 49" error.
The problem disappears when I change my Gmail's language setting to English.
Line 134 of importGmail.class.php says
$tempname = split('All Contacts',$html2,2);
but the "All Contacts" part changes depending on Gmail's language setting.
For example, if the language is set to Japanese, the string is "すべての連絡先" rather than "All Contacts".
In this case, changing the code to
$tempname = split('すべての連絡先',$html2,2);
allowed me to import the contacts.
Can anyone come up with a solution that works for any language setting?
Comment #23
andypostThere's a API http://code.google.com/apis/contacts/
I change this line to
Now it woks for russian language but at the end of list I see a garbage from bottom so I add another split and change index
Comment #24
derjochenmeyer CreditAttribution: derjochenmeyer commented#23 thats a good approach but it does not return a clean contact list. Comments and postal adresses are included sometimes.
The Google DATA API is an option, but it requires the user to first login to his/her google account. Then an authorization token is received. This makes the process safer for the user but also more inconvenient.
http://code.google.com/apis/contacts/developers_guide_protocol.html
But different language settings are obviously a problem that is not easy to handle, right? To use the API is the cleanest method...
Comment #25
andypostTake a look at http://code.google.com/apis/contacts/developers_guide_protocol.html#clie...
Suppose this type of auth is preferred (we have a email & pass)
After that we can query a contacts feed as described
http://code.google.com/apis/contacts/developers_guide_protocol.html#retr...
Then xml parsing
Comment #26
derjochenmeyer CreditAttribution: derjochenmeyer commentedwow, i completely overread this...
so we need to make a request like this
we receive an Authentication Token which we then have to include as header information in requesting the contact list...
Comment #27
j0k3z CreditAttribution: j0k3z commentedhas this been fixed? Just downloaded the module and get this error...
Comment #28
stashlbai CreditAttribution: stashlbai commentedWe have written a GData contacts importer using the API mentioned above. It's attached as a patch. It works for us and your mileage may vary. In particular, we take advantage of PHP5 and the DOM extensions.
The dcl_wrapper.inc script has the changes to load in the new class instead of the old. The new class does not depend on baseclass.php.
The dcl_importer.module has changes to pass through the entire email address when querying GMail. This allows GoogleApps users to also get their contacts, even though their username is not of the form username@gmail.com.
Comment #29
andypostPatch from #28 works but retrives only 25 items
I think all because of this :
static $url_Feed = 'http://www.google.com/m8/feeds/contacts/default/thin';
I've tried to change it as proposed http://code.google.com/apis/contacts/developers_guide_protocol.html#retr...
to contacts/default/full and contacts/[myinbox]%40gmail.com/full but unsuccessfully - only 25 contacts
Another question if we have a name of contact why not to use
user name <email>
form of contacts?Comment #30
stashlbai CreditAttribution: stashlbai commentedThe URL should read
if you want 100. You can't ask for "all" but you can ask for 65535, for example. See http://code.google.com/apis/contacts/reference.html#Parameters for more information.
This leads to all kinds of other things to discuss. What do you do with 100 contacts on the invite form? Why does the invite module discard the name information? Wouldn't it be nice for this to work like LinkedIn where you get a list of potential contacts and then get to choose (check box, drag and drop, etc) which subset to work with?
What's the future of this module? It seems to have gone dormant. I don't know that we would be in a position to step in and take on this whole module; right now, what we can provide is the patch. If someone can pick this module up and run with it we can help with functionality, rewriting, etc. for the Google part.
Comment #31
andypostThanks a lot! A number of users is optional.
But it starts a new interesting discussion...
Comment #32
timbednar CreditAttribution: timbednar commentedThanks so much for the work here -- I believe I'm getting an error with the above patch and new GData contacts importer class. Any help for those of us who are not running php5?
Comment #33
stashlbai CreditAttribution: stashlbai commentedtimbednar,
You've exposed exactly why we can't fully take on supporting module code - at this time, we don't have the resources to support the code/patches/testing for PHP != 5 or Drupal != 5. If you can reproduce the error for (PHP, Drupal) == (5, 5) then we can take a look.
At this time, we're working on building out our sites' functionality by stitching together (and patching where necessary) contrib modules, while also writing custom module/theme code. Once we go into maintenance mode on this version of our site(s), then we will see what modules if any we can contribute back or adopt, knowing that fully taking on a module basically means supporting all combinations of PHP(4, 5) and Drupal(5, 6, 7) etc.
With that said: if you can post the error you're getting while applying (or running) the patch, we might be able to give a suggestion; or someone else might recognize the issue and give an answer.
Comment #34
romainlav CreditAttribution: romainlav commentedalways have error :(
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /drupal-5.7/modules/dcl_importer/scripts/importGData.class.php on line 5
Comment #35
andypostThere's another discussion http://groups.drupal.org/node/9824
Comment #36
bowwowadmin CreditAttribution: bowwowadmin commentedis this going to be committed the patch that is it works great. solved the issue
Comment #37
andypostMain problem in requirements - php5 curl
Comment #38
fumanchu182 CreditAttribution: fumanchu182 commentedI applied that patch and received the following error:
Fatal error: Class 'GDataMailer' not found in /home/...sites/all/modules/dcl_importer/dcl_wrapper.inc on line 31
Page execution time was 381.22 ms.
This is how i applied the patch:
patch -b < gdata-importer.patch
This was done from the module root.
-Anthony
Comment #39
fumanchu182 CreditAttribution: fumanchu182 commentedsee http://drupal.org/node/208874#comment-962775 (right below this one)
Comment #40
fumanchu182 CreditAttribution: fumanchu182 commentedAfter looking at the whole thing there is a directory issue configuration. The original segment is:
function importGmail($login, $password) {
include ('scripts/importGData.class.php');
global $names;
global $emails;
$gmailer = new GDataMailer();
The include statement points to a file that is one directory below scripts. I don't know if this happened because of the patch but but I am going to leave it as part of the root directory and I have changed my include call to be :
include (drupal_get_path('module', 'dcl_importer').'/importGData.class.php');
This will allow you to move it to scripts eventually but just updating the string part of the include function.
-Anthony
Comment #41
abqaria CreditAttribution: abqaria commentedplease update the module with latest patch
Comment #42
bflora CreditAttribution: bflora commentedI'm getting the following error when I run a search for 100+ gmail contacts:
Call to a member function getAttribute() on a non-object in path/to/drupal/sites/all/modules/dcl_importer/scripts/importGData.class.php on line 97
it works fine when I don't specify how many results to return. Gives me this error when I do.
Here's the line in question:
$email = $mnode->getAttribute('address');
Comment #43
bflora CreditAttribution: bflora commentedI got someone over on Stack Overflow to help me with this:
http://stackoverflow.com/questions/827343/whats-wrong-with-this-gmail-co...
Comment #44
hadsie CreditAttribution: hadsie commentedI'm marking this issue as "closed". The D5 version of this module is no longer being maintained. The original version had scripts that no longer worked and some that weren't compatible with the GPL. The D6 version is being developed now and is a complete re-write using the OpenInviter library. If you wish to submit a backport to D5 I'll be happy to add that to CVS. Please see the project page for more details.
Comment #45
plan9 CreditAttribution: plan9 commentedUsing the patch and tweak at #28 and #40 I am able to use the 5.x version. All imports work except MySpace - which I'm not interested in anyway.
I hope there will be a backport of the 6.x branch soon.
Thanks for this great module :)
G
Comment #46
smiletrl CreditAttribution: smiletrl commentedThere's one project for Gmail contact https://www.drupal.org/project/gmail_contact