Page 1 of 1

Error in TwitterOAuthApi.php

Posted: Sun Jun 02, 2013 9:56 am
by Bla
When I try to announce a blogpost via Twitter (for me it's the first time to do that automatically while posting), first of all, there is no visual error. But the tweet is not send. When I try to „check tweetbacks“ I'll get an
Invalid argument supplied for foreach() in /…/plugins/serendipity_plugin_twitter/classes/TwitterOAuthApi.php on line 35
Any hints? serendipity_event_twitter has version 1.49 and uses API 1.1

Re: Error in TwitterOAuthApi.php

Posted: Sun Jun 02, 2013 10:48 am
by Timbalu
I am not making use of twitter or this plugin personally, so I can not say how it is working in general.

If I have a look in that errored code line, it tells me, we are in search() function, trying to get something back from via an URL with a GET ?q=' . $search; string.

The errored line says:

Code: Select all

foreach ($json->statuses as $item)
which could hint us to $json->statuses being empty or not existable.

So we (maybe) could add a simple if( is_array($json->statuses) && !empty($json->statuses) ) or similar right before the foreach loop and surround the latter code part with an { }, or think about this is questioning twitter about a search result, which isn't there yet. Maybe you just started and the error will vanish, as soon you have some twitter comments...? (wild guess!)

You could also ask Grischa at about this, since I think he invented this somehow.

Re: Error in TwitterOAuthApi.php

Posted: Mon Jun 24, 2013 8:57 pm
by Bla
Some days ago my sidebar-tweets were not updated. After some diggin around I found my plugin-settings not fully switched to OAuth. In addition it was necessary to clean the templates_c folder. My tweets are back and I can check the tweetbacks.