We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Twitter Timeline Error

Development and Programming

Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Did you update to the latest version and clear your caches, bigblue? Seeing how Lissa hasn’t replied to this thread or me privately since the original correspondence, I gather she has not followed this issue nor applied the fix. The plugin is now doing all it can to degrade gracefully when Twitter is having service problems.

Where are you getting that statistic, is it published? Perhaps that is accumulated time of their web service being down? Interesting in any case, and still remarkably bad considering that it’s spread out over many days during peak usage, but still doesn’t account for other problems such as faulty connectivity, slowness, and data syncing with their API, which can cause any service that uses it to fail at times even when their web service is up.

       
bigblue's avatar
bigblue
11 posts
17 years ago
bigblue's avatar bigblue

Hi Derek, thanks for your prompt reply.

I had applied the fix and cleared my caches. The problem occurs when twitter is down. LissaKay’s twitter timeline also wasn’t working when the site was down and is working now (as is mine, without further intervention).

Part of the problem is that it seems to “break” my template html when Twitter is down. In my case it only occurs when I’m logged on (perhaps it’s the debugging error messages?). However looking at LissaKay’s site yesterday, I most certainly wasn’t logged in and it seemed to “break” her layout too.

The statistic appeared on the Twitter forums - yes, it is the accumulated time they were down over the past 12 months (allegedly).

The output of the Twitter Timeline plugin when Twitter was down was as follows (at both my site and LissaKay’s):

profile image
~ 7 years, 5 months, 3 weeks, 3 days, 18 hours, 59 minutes ago

profile image
~ 7 years, 5 months, 3 weeks, 3 days, 18 hours, 59 minutes ago

The template debugging messages were as per LissaKay’s post above.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

What are the contents of your Twitter Timeline cache file at that point, bigblue? It shouldn’t be making it to variable parsing unless a valid, tweet-filled XML response is received.

       
bigblue's avatar
bigblue
11 posts
17 years ago
bigblue's avatar bigblue

Mmm. Next time it happens I’ll let you know. I didn’t keep a copy.

       
bigblue's avatar
bigblue
11 posts
17 years ago
bigblue's avatar bigblue

OK, here goes.

Here’s the error messages first:

Notice: Undefined index: user in /home/system/plugins/pi.twitter_timeline.php on line 197

Notice: Undefined index: created_at in /home/system/plugins/pi.twitter_timeline.php on line 259

Notice: Undefined offset: 1 in /home/system/plugins/pi.twitter_timeline.php on line 519

Notice: Undefined offset: 0 in /home/system/plugins/pi.twitter_timeline.php on line 520

Notice: Undefined offset: 5 in /home/system/plugins/pi.twitter_timeline.php on line 522

Notice: Undefined offset: 2 in /home/system/plugins/pi.twitter_timeline.php on line 522

Notice: Undefined offset: 3 in /home/system/plugins/pi.twitter_timeline.php on line 522

Notice: Undefined index: user in /home/system/plugins/pi.twitter_timeline.php on line 197

Notice: Undefined index: created_at in /home/system/plugins/pi.twitter_timeline.php on line 259

Notice: Undefined offset: 1 in /home/system/plugins/pi.twitter_timeline.php on line 519

Notice: Undefined offset: 0 in /home/system/plugins/pi.twitter_timeline.php on line 520

Notice: Undefined offset: 5 in /home/system/plugins/pi.twitter_timeline.php on line 522

Notice: Undefined offset: 2 in /home/system/plugins/pi.twitter_timeline.php on line 522

Notice: Undefined offset: 3 in /home/system/plugins/pi.twitter_timeline.php on line 522

And here are the contents of the cache:



And this is what gets “twittered”:

7 years, 5 months, 3 weeks, 4 days, 15 hours, 28 minutes ago
7 years, 5 months, 3 weeks, 4 days, 15 hours, 28 minutes ago

The variables seem to be all blank, so the links (that I configured) are all to:

http://twitter.com//statuses/
       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Odd, it shouldn’t be parsing that as XML, bigblue, it should be failing and returning an empty string, and logging the message “Twitter Timeline error: Unable to retreive statuses from Twitter.com”. Following the conditional on line 127 that reads:

if (($xml_obj = $XML->parse_xml($rawxml)) === FALSE)
{
    $TMPL->log_item("Twitter Timeline error: Unable to retreive statuses from Twitter.com");
    $this->return_data = '';
    return;
}

Can you add:

echo '<pre>';print_r($xml_obj);echo'</pre>

<p>’;
</pre>

And then cut and paste the output? If the service is connecting successfully, overwriting the contents of your cache file manually with what you have above (except the first line, the timestamp) should force a triggering of these errors you are receving.

       
bigblue's avatar
bigblue
11 posts
17 years ago
bigblue's avatar bigblue

This is the output:

Notice:  Undefined variable:  xml_obj in /home/system/plugins/pi.twitter_timeline.php on line 103

Followed by the other debugging messages.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Double check that you are placing it after the right conditional, it should be after the one on line 127 displayed above.

       
bigblue's avatar
bigblue
11 posts
17 years ago
bigblue's avatar bigblue

OK, maybe I had it in the wrong place because this looks more like what you are expecting. I have attached it as a file because it is too big to post here.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Unusual, with that source, both systems I am testing on still return FALSE on attempting to parse it.

At any rate, this should solve the problem so long as Twitter keeps sending HTML content when the API is down. Please give it a try and let me know, at your convenience; this is a long weekend afterall. :-D

       
bigblue's avatar
bigblue
11 posts
17 years ago
bigblue's avatar bigblue

Hi Derek,

Sorry for the delay in getting back to you.

I implemented the change, but I also did another adjustment. I entered “-60” into the server offset parameter in the control panel. (I had noticed that the time of my posts in the twitter timeline was incorrect).

Now I don’t get the error, and when Twitter is down the timeline is simply blank.

cheers, BBM

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Excellent, I’ll get the add-on updated today then, BBM. Incidentally, if you had to move the server offset by a full hour, it sounds like either your server timezone, daylight saving setting, or your user’s localization settings for one of those values is off.

       
Arbinshire's avatar
Arbinshire
42 posts
17 years ago
Arbinshire's avatar Arbinshire

Since twitter is down, yet again, I’ve been having problems with it failing and displaying ugly error messages. I looked at the twitter plugin code, and echo’d the $rawxml data and saw that the plugin wasn’t parsing it correctly.

Being the lazy coder I am, I opted to just search for the “</error>” xml closing tag, and if it finds it, just return an error and stop further processing from the plugin. Below is my code (inserted after line 96 of pi.twitter_timeline.php):

if (preg_match("/(<\\/error>)/is", $rawxml)) { 
        $TMPL->log_item("Twitter is down.");
        $this->return_data = 'Twitter is down, again.';
        return;
      }

Twitter error message:

<?xml version="1.0" encoding="UTF-8"?>
<error reason="temporary maintenance" deadline="30 minutes">
  Twitter is down for temporary maintenance. It will return in 30 minutes.
</error>
       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Have you updated the plugin, Arbinshire? It checks for the <error> response now.

       
Arbinshire's avatar
Arbinshire
42 posts
17 years ago
Arbinshire's avatar Arbinshire

I did and I was still getting error messages throw. I think around lines 133/135 and lines 300.

       
1 2 3 4 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.