Closed (fixed)
Project:
OAuth 1.0
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Nov 2011 at 18:27 UTC
Updated:
18 May 2017 at 13:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
karlitos commentedSame here,
getting this error in the logs, after every cron.
Comment #2
psykomf commentedI have the same problem with my drupal 6 site. can't run cron and it gives this error. Any advice would be appreciated
Comment #3
ravi.kumar commentedHi,
Have you found any solution for this, I am facing the same error
Error: Cannot redeclare class OAuthException in /sites/all/modules/oauth/oauth.lib.php, line 17
WD cron: Cron run exceeded the time limit and was aborted.
Fatal error: Cannot redeclare class OAuthException in /sites/all/modules/oauth/oauth.lib.php on line 17
Drush command terminated abnormally due to an unrecoverable error.
Comment #4
erikwegner commentedI had this issue, too. It was because I updated from 2.02 to 3.0b4 without removing the module directory, instead I just put all files into the existing directory. After deleting the oauth directory and placing a fresh version, the error is gone (see also #958126: Extra class OAuthException Declaration?)
Comment #5
karlitos commentedErikWegner
#4 -> BINGO!!!!! I cleaned the system tables from oauth and I install it again and it works with no error whatsoever
Comment #6
ravi.kumar commentedError fixed after upgrading OAuth module to latest version, as both OAuth and OAuth common modules are merged to single OAuth module.
Comment #7
buildyourbox commentedThanks ErikWegner, post #4 worked for me.
Regards,
Build Your Box.
Any feedback appreciated.
Comment #8
kylebrowning commentedComment #9
yuriy.babenko commentedI was getting the same error in 7.x-3.0 (and 7.x-3.0-dev). Single 'class OAuthException' instance in entire codebase, but 'cannot redeclare class' error being thrown. Turned out that my PHP installation was compiled with OAuth, so that's where the first copy of the class was coming from. Perhaps it's a good idea to move the OAuth.php file inclusion out of oauth_common.info and into the module, and wrap it in a
if (!class_exists(...))?//edit:
Wrapping just the
OAuthExceptionclass declaration in aif (!class_exists(...))did the trick for my system. In hindsight, using namespaces may be a possible solution here.Comment #10
leksat commentedIf PHP installation has OAuth extension, loading of OAuth.php fails with fatal error because OAuth extension already contains OAuthException class.
IMO, the solution from #9 (wrapping with class_exists()) is the right way. Because sometime, for instance on shared hosting, we have no ability to manage PHP extensions.
Comment #11
leksat commentedComment #12
drupsup commented@Leksat, fyi -
with
and
getting this error:
applying patch @ #11; applies successfully to D7+OAuth7x3.
No more error.
Comment #13
drupsup commentedComment #14
alandarev commentedI installed pecl OAuth for php in order to communicate with OAuth services, and Drupal site stopped working due to redeclaration of OAuthException.
Patch in comment #11 indeed works well and solved my problem. I am hoping to see it included in next version
Comment #15
ppfranco commentedapplied patch and no more errors!! THAnKS!!! #11...D7
Comment #16
juampynr commentedUntil propper PECL support is implemented, I have committed the patch of comment #11.
Committed to 7.x-3.x, 6.x-3.x and Github.
Many thanks.
http://drupalcode.org/project/oauth.git/commitdiff/72a7d8e
http://drupalcode.org/project/oauth.git/commitdiff/89f9658
http://drupalcode.org/project/oauth.git/commitdiff/ab17363
https://github.com/juampy72/OAuth-PHP/commit/61ab0a3f284e3c7b93e53a3e85f...
Comment #18
muhammad.tanweer commented#4 works for me. Thanks for the clue. I removed the directory of oAuth and replaced with new version of the module. All worked.
Muhammad Tanweer
http://www.app-desk.com
Comment #19
sahirmathur commentedI tried this and it didnt work for me, replaced the oauth directory with a new latest copy from https://www.drupal.org/project/oauth
Does anyone know how to install the patch file? I am on a shared host
Comment #20
erikwegner commentedYou can either
a) download the file from the repository ( go to http://cgit.drupalcode.org/oauth/tree/lib/OAuth.php and select your module version, then use the whole file) or
b) download your current file from your shared host (sites/all/modules/oauth/lib/OAuth.php
), download the diff, apply the diff and upload the modified file to the shared host. Because the diff is small, you can even edit the OAuth.php by hand. Just look into the diff file, it is plain text.
Good luck.
Comment #21
zhouhana commentedI can't read PHP very well myself, so I just want to double check. Because of the recent security release to OAuth I'm trying to update the module for a few sites, and now I'd like to reapply the patches that were previously applied, so the sites don't lose any important functionality.
The release notes for OAuth say nothing about this patch being included in the non-dev branch. When I try to apply it through the command line I get this:
(By the way, why did I need to enter the path manually? It's the same path as specified in the patch.)
What should I do now? I'm thinking that since the patch is so old maybe there's some kind of mismatch between it and the code that is now in 7.x-3.3 that would need to be reviewed?
Comment #22
erikwegner commentedJust a guess here: do not use
-p1, as-pmeans: ignore directory levels in the patch file, and the digit means one level. Effectively you loose the sites path. Either use-p0or do not use it at all.Comment #23
zhouhana commentedThanks for the info about
-p1– I had no idea. I still get the same result without it, though.Comment #24
fuzzy76 commentedFWIW, here's a patch rolled against 6.x-2.02.