I find the following error in my Apache 2 error log:
PHP Fatal error: Class 'OAuthSignatureMethod_HMAC_SHA1' not found in my_site_path/sites/all/modules/twitter/twitter.lib.php on line 40, referer: http://my_site.com/?q=nl/admin/reports/status
This is the twitter.lib.php code block it refers to
public function __construct($consumer_key, $consumer_secret, $oauth_token = NULL,
$oauth_token_secret = NULL) {
$this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
$this->consumer = new OAuthConsumer($consumer_key, $consumer_secret);
if (!empty($oauth_token) && !empty($oauth_token_secret)) {
$this->token = new OAuthConsumer($oauth_token, $oauth_token_secret);
}
}
Comments
Comment #1
dhuyvetter commentedForgot to mention I get this error when I try to run cron and as a result cron isn't working.
Comment #2
spidersilk commentedI got that too, right after upgrading from 6.x-3.0 to 6.x-5.1.
What you need to do is check what version of the OAuth module you're using - if you're still on version 2 (i.e. 6.x-2.x), you need to upgrade to version 3 (which is still in beta, but seems to work fine). That fixed it for me.
I found that info here: #1255510: Upgrade to oauth 3.x (oauth_common) - but it would be nice if the requirement to use version 3 of OAuth were stated on the module project page, or at least in the Read Me file. There's a link in that post to a diff of the Read Me file showing it being added (at some point), but it doesn't seem to be in the file for the current version of the module - instead it just says:
"Latest stable version" is a bit ambiguous given that OAuth 3 is still in beta - it makes it sound like you need to use version 2, which in fact won't work. Plus, the path given for the Twitter settings page is the Drupal 7 path, in the Read Me for the D6 version of the module.
Comment #3
damienmckennaIt probably needs a hook_requirements to check the version of the OAuth module installed.
Comment #4
damienmckennaDoes this help? It should check if the correct version of the OAuth module is installed.
Comment #5
damienmckennaI've changed it to look for oauth_common/lib/OAuth.php instead of looking for a class because loading twitter.inc will fail if OAuth v2 is installed.
Comment #6
damienmckennaCommitted.