Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fatal Error: InvalidArgumentException #139

bradleybernard opened this Issue Mar 27, 2012 · 6 comments


None yet
2 participants

I am getting a PHP Fatal Error: InvalidArgumentException a lot and was wondering how to fix it. Here is the error_log:

[22-Mar-2012 20:01:40] PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Passed variable is not an array or object, using empty array instead' in /home/bradley/public_html/twitter/EpiTwitter.php:174
Stack trace:
#0 /home/bradley/public_html/twitter/EpiTwitter.php(174): ArrayIterator->__construct(NULL)
#1 /home/bradley/public_html/index.php(394): EpiTwitterJson->getIterator()
#2 {main}

$comma_separated = implode(",", $followingarr);
$usernames = $twitterObj->post('/users/lookup.json' , array('user_id' => $comma_separated));
$followingarray = array();
foreach ($usernames as $user) {
$followingarray[] = array('username' => $user->screen_name, 'id' => $user->id);

I commented out lines 171 + 172 in EpiOAuth.php but it did not fix it for me.

Any help?


jmathai commented Mar 28, 2012

Can you dump the responseText? It's been a while since I've looked at
Twitter's API but I'd think that the lookup API is a get and not a post. If
that's the case it might be why you're getting that error.

echo $usernames->responseText;

Ok, I dumped the responseText and it is very large. Here is a pastebin link: http://pastebin.com/r2UkcKCr

Twitter allows POST/GET on users/lookup: https://dev.twitter.com/docs/api/1/get/users/lookup

The error happens very quickly, right when the page loads. It seems as if I am trying to loop through the $usernames before it has actually gotten the data from the API. Isn't it supposed to block?

I noticed you have made some changes to the files recently. I downloaded the files roughly a year ago. Should I download the new files? Are there any significant changes?

I get that error every 10 minutes on my website which is way too much...

Another error I'm getting:

[11-Mar-2012 15:57:27] PHP Fatal error: Uncaught exception 'EpiOAuthUnauthorizedException' in /home/bradley/public_html/twitter/EpiOAuth.php:421
Stack trace:
#0 /home/bradley/public_html/twitter/EpiOAuth.php(393): EpiOAuthException::raise(Object(EpiCurlManager), false)
#1 /home/bradley/public_html/twitter/callback.php(14): EpiOAuthResponse->__get('oauth_token')
#2 {main}
thrown in /home/bradley/public_html/twitter/EpiOAuth.php on line 421


$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);
if (isset($_GET['denied']) && $_GET['denied'] != '')
header('Location: ../me');

$token = $twitterObj->getAccessToken();
#14 - $twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);


jmathai commented Mar 28, 2012

I'd definitely get the latest files. There haven't been many changes
recently but all of them have been bug fixes. Here are some common errors,

Unfortunately I don't have a lot of time to help debug specific issues. You
can check simpleTest.php to see if the library is working okay.
Additionally you can loop over $usernames->response if you think it's not
blocking properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment