Closed (duplicate)
Project:
Twitter
Version:
6.x-3.0-beta2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 Sep 2010 at 06:32 UTC
Updated:
2 Sep 2010 at 04:39 UTC
I recently upgraded to 6.x-3.0-beta2 since Twitter discontinued support for basic authentication. However, since then I have been consistently seeing this error on my Logs.
Invalid argument supplied for foreach() in /home/kiran/public_html/sites/all/modules/twitter/twitter.lib.php
Also, I have noticed that the latest twitter updates fail to import. All was working fine on 6.x-2.6. Hence, I am not sure if this is related to the version upgrade or something on Twitter's side with their OAuth mechanism.
Any help would be greatly appreciated.
Regards,
KH
Comments
Comment #1
kjholla commentedOn reading up more on this issue, I see that the problem already has a fix at http://drupal.org/node/685964.
Applying the patch provided in that thread will probably fix the Invalid argument error coming up in the log. However, what bothers me more is why is the call to the twitter api failing?
I have consistently seen that all calls made via the cron to the twitter api fail. However, if I log on as the user to whom the twitter account belongs and then run the cron manually, the import succeeds without the error.
This tells me that something is wrong with the authentication when the cron is running as an anonymous user, which causes the twitter api call to fail each time.
Could someone help?
Regards,
KH
Comment #2
kjholla commentedOK. This is my bad.
I just realized that the fix provided at http://drupal.org/node/685964 will work. I have applied it and it does work.
The cron run eventually runs the following function in twitter.lib.php
Here, if the twitter api call returns no new statuses (say, if the cron runs before any additional twitter updates have been made), it results in the Invalid argument error that I earlier mentioned as there are no new twitter updates to import.
By applying the patch provided at http://drupal.org/node/685964, this function is changed to:
Here, the foreach loop is executed only if the twitter api call has returned something. I realized that the twitter api call not returning any rows wasn't a problem since there were no new twitter updates in the first place.
Apologies for being daft about this. But, hey, I figured it out in the end.
Regards,
KH
Comment #3
kjholla commentedClosing as this is effectively a duplicate of http://drupal.org/node/685964