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

dhuyvetter’s picture

Forgot to mention I get this error when I try to run cron and as a result cron isn't working.

spidersilk’s picture

I 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:

OAuth module is required for all requests to the Twitter REST API 1.1. When you download the OAuth module, get the latest stable release available at http://drupal.org/project/oauth

Once OAuth and Twitter have been enabled, go to admin/config/services/twitter and follow instructions in order to provide your Twitter Application keys.

"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.

damienmckenna’s picture

Version: 6.x-5.1 » 6.x-5.x-dev
Issue summary: View changes

It probably needs a hook_requirements to check the version of the OAuth module installed.

damienmckenna’s picture

Status: Active » Needs review
Parent issue: » #2402311: Plan for Twitter v6.x-5.2 release
StatusFileSize
new1006 bytes

Does this help? It should check if the correct version of the OAuth module is installed.

damienmckenna’s picture

StatusFileSize
new1.4 KB

I'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.

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

  • DamienMcKenna committed 744397f on 6.x-5.x
    Issue #2025899 by DamienMcKenna: Give a warning if OAuth v2 is installed...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.