Page 1 of 1

OAuth Error with Twitter in Microblogging Plugin

Posted: Mon Jun 09, 2014 1:16 pm
by rowi
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

Re: OAuth Error with Twitter in Microblogging Plugin

Posted: Thu Jun 12, 2014 3:04 pm
by garvinhicking
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

Re: OAuth Error with Twitter in Microblogging Plugin

Posted: Thu Jun 12, 2014 5:11 pm
by rowi
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.

Re: OAuth Error with Twitter in Microblogging Plugin

Posted: Tue Jun 17, 2014 12:21 pm
by garvinhicking
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

Re: OAuth Error with Twitter in Microblogging Plugin

Posted: Tue Jun 17, 2014 8:30 pm
by rowi
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.