UPDATE: The fix to this issue requires you to download a new version of the php-proauth library! See this comment for details.

Since this module removed the OAuth module dependency and includes OAuth on its own, it now conflicts when used with a module that requires OAuth, such as Twitter. If both are used in the same page request, the OAuth classes are declared twice and causes a 500 server error.

This happens consistently on cron with the OAuth and Twitter modules enabled and a feed with OAuth authentication. The error does not occur when OAuth is disabled.

Comments

Phil Wolstenholme’s picture

Same problem for me:

Fatal error: Cannot redeclare class OAuthException in ... /sites/all/libraries/php-proauth/lib/oauth/OAuthUtil.php on line 82

I'm using:

Feeds OAuth Fetcher - 7.x-1.0-beta1+3-dev
OAuth - 7.x-3.1+4-dev

infojunkie’s picture

Thanks, working on it.

kc99’s picture

Any new developments on this issue?

kscheirer’s picture

Priority: Normal » Critical

Both modules should be using the Libraries API module to handle this conflict.

cwithout’s picture

How would Libraries API handle two classes loaded into the same page request with the same class names? I'm not aware of any way it can prevent the issue of the class name already being declared.

Or are you suggesting that by using Libraries API, only one OAuth class would be loaded? It's not as simple as that, because the OAuth module and Feeds OAuth module use different OAuth libraries. The classes are named the same, but their properties and methods are different. So the code would have to be changed on one or the other so they're using the same OAuth library.

In which case, there might be no benefit to Feeds OAuth loading the OAuth library on its own rather than using the OAuth module as a dependency for loading the OAuth library as it used to.

kscheirer’s picture

Priority: Critical » Normal

Ah, sorry, I didn't understand the issue then. Any suggestions? Seems like going back to a dependency on oauth module would fix the problem, but they only support oauth 1.0 - how big of a problem is that?

Is the report in #2 still valid? Looking at the 7.x-3.x branch of oauth: http://drupalcode.org/project/oauth.git/blob/refs/heads/7.x-3.x:/lib/OAu..., it seems they've added a check to make sure OAuthException wasn't already defined. But I guess that doesn't help if you can't control the order in which they're loaded.

There's a thread in the oauth issue queue (#1591692: Replace current OAuth library) with some reservations about even supporting 2.0, partly because of the lead developer's post http://hueniverse.com/2012/07/oauth-2-0-and-the-road-to-hell/.

infojunkie’s picture

I am planning to move to Guzzle to perform OAuth and consume feeds. The conflict will go away then: #2140263: Use Guzzle instead of php-proauth

infojunkie’s picture

Issue summary: View changes
Status: Active » Fixed

Fixed the conflict by forking the original php-proauth library and adding a namespace around their classes.

Please update the library as per the new installation instructions.

infojunkie’s picture

Issue summary: View changes
infojunkie’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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