OAuth Error with Twitter in Microblogging Plugin

Found a bug? Tell us!!
Post Reply
User avatar
rowi
Regular
Posts: 77
Joined: Fri Mar 16, 2007 9:10 pm
Location: Flensburg / Germany
Contact:

OAuth Error with Twitter in Microblogging Plugin

Post by rowi » Mon Jun 09, 2014 1:16 pm

Hi,

I've updated the Microblogging Plugin yesterday and today and these Versions give me the following error when they try to send a tweet:
Fatal error: Cannot redeclare class OAuthException in /mounted-storage/home126/sub001/sc73540-KSFN/www/stdlw/s9y/plugins/serendipity_plugin_twitter/twitteroauth/OAuth.php on line 8
I've removed the token but receive the same error when trying to link the account again.
Tried with PHP 5.3 and 5.4

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: OAuth Error with Twitter in Microblogging Plugin

Post by garvinhicking » Thu Jun 12, 2014 3:04 pm

Hi!

Did you maybe create a backup of the old plugin in the plugins/ directory too? It seems like the same file gets included already.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
rowi
Regular
Posts: 77
Joined: Fri Mar 16, 2007 9:10 pm
Location: Flensburg / Germany
Contact:

Re: OAuth Error with Twitter in Microblogging Plugin

Post by rowi » Thu Jun 12, 2014 5:11 pm

No, I usually don't make a backup of a plugin because the update routine works so well.

Is there a way to get more informations from php where the class was defined first? I've enabled the debug mode but this doesn't give more details and I've downloaded the whole s9y installation but grep only finds the string OAuthException in OAuth.php which hasn't changed for years.

So I'm confused, something has changed obviously but not necessarily the microblogging plugin.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: OAuth Error with Twitter in Microblogging Plugin

Post by garvinhicking » Tue Jun 17, 2014 12:21 pm

Hi!

We might need to do it the hard way then.

Please edit your serendipity_plugin_twitter/twitteroauth/OAuth.php file and replace this:

Code: Select all

class OAuthException extends Exception {
  // pass
}
with:

Code: Select all

$GLOBALS['oauthcount']++;
$fp = fopen('/tmp/oauth.log', 'a');
fwrite($fp, date('d.m.Y H:i.s') . ' - ' . $_SERVER['REQUEST_URI'] . ' - ' . dirname(__FILE__) . ': OAuth lib included for the ' . $GLOBALS['oauthcount'] . '. time' . "\n");
fclose($fp);

if (!class_exists('OAuthException')) {
	class OAuthException extends Exception {
	  // pass
	}
}
This adds a debugging output whenever the file is iinncluded, and writes that to /tmp/oauth.log (adapt the path if you cannot access that file).

The other if() check actually prevents the dual declaration of the classname so you might not get the PHP error anymore. Do check the logfile though, at some point you should see a "OAuth lib included for the 2. time" statement?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
rowi
Regular
Posts: 77
Joined: Fri Mar 16, 2007 9:10 pm
Location: Flensburg / Germany
Contact:

Re: OAuth Error with Twitter in Microblogging Plugin

Post by rowi » Tue Jun 17, 2014 8:30 pm

Now I'm completely confused. After making these changes everything works just fine. No errors and the count in outh.log is 1.
I haven't changed anything else since last week.

Post Reply