Type: php
Invalid argument supplied for foreach() in /usr/home/hoslo/public_html/sites/all/modules/twitter/twitter.lib.php on line 81.
Backtrace: get_statuses(...)[twitter.lib.php:118] <=user_timeline(...)[twitter.inc:90] <=twitter_fetch_user_timeline(a:1:{i:0;s:1:"0";})[twitter.module:116] <=twitter_cron(a:0:{})[:] <=call_user_func_array(...)[module.inc:483] <=module_invoke_all(...)[common.inc:2692] <=drupal_cron_run(a:0:{})[system.admin.inc:1722] <=system_run_cron(a:0:{})[:] <=call_user_func_array(...)[menu.inc:348] <=menu_execute_active_handler(a:0:{})[index.php:18] <=index.php

CommentFileSizeAuthor
#5 twitter-685964.patch5.37 KBderhasi

Comments

bcobin’s picture

Title: nvalid argument supplied for foreach() in ../sites/all/modules/twitter/twitter.lib.php on line 81. » Invalid argument supplied for foreach() in ../sites/all/modules/twitter/twitter.lib.php on line 81.

Same error - happens on cron run. Any ideas? Thanks!

bcobin’s picture

Problem seems to be solved - for me. See post here: http://drupal.org/node/720378#comment-2661386

adamyonk’s picture

I'm getting a similar error every time I run cron. No Twitter statuses get imported and there is one error for each Twitter account that's being checked.

warning: Invalid argument supplied for foreach() in /nfs/c01/h09/mnt/6030/domains/elevatevc.com/html/thought/sites/all/modules/twitter/twitter.lib.php on line 81.

skyredwang’s picture

Priority: Normal » Critical

same here, on cron run

derhasi’s picture

Assigned: Unassigned » derhasi
Status: Active » Needs review
StatusFileSize
new5.37 KB

The main reason for the error is a missing return handling in Twitter::get_statuses(). To fix this I attached a patch.

One case get_status (or the call to twitter) fails, is when dealing with protected twitter accounts. Especially if an account has been set to protected on twitter, after it has been created on the drupal site - or the simple one, the password was entered wrong.

For the case a user changes the protection on twitter after the creation on the drupal site, there should be written another patch. Maybe I'll open a new issue for that, when I got a solution.

@walkah / @eaton - the next days I'd like to commit some patches, especially for enabling coordinates support, but also for some authentication fixes (like the one mentioned above).

derhasi’s picture

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Patch applies fine, PHP warning is fixed, code looks good.

bsmith451’s picture

Version: 6.x-3.x-dev » 6.x-3.0-beta2

I'm have this same error with 6.x-3.0-beta2. Was the patch in this thread included in the beta? I'd like to know before I try to patch the file

Thanks,

derhasi’s picture

Version: 6.x-3.0-beta2 » 6.x-3.x-dev

The patch is not included in the beta, as the dev version is newer than the beta. The patch in #5 should be applied to the current 6.x3-dev.

damienmckenna’s picture

+1 for inclusion in the next update.

walkah’s picture

Status: Reviewed & tested by the community » Fixed

committed, thanks folks!

Status: Fixed » Closed (fixed)

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