Closed (duplicate)
Project:
Twitter
Version:
7.x-3.x-dev
Component:
Twitter Actions
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Aug 2012 at 09:59 UTC
Updated:
7 Nov 2012 at 17:36 UTC
Fatal error: Wrong parameters for Exception([string $exception [, long $code ]]) in /home/tulasira/public_html/drupal/sites/all/modules/twitter/twitter.lib.php on line 18
After setting up the twitter module...
When you create content and publish...
Appears in a blank page...
Kindly solve this...
Thank You,
Comments
Comment #1
Golem07 commentedI am having the very same problem.
Comment #2
ytsuhako commentedi move my site rental server to local xampp.
so i have same error.
event reports
Unexpected error: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
i enable openssl. so no error.
Comment #3
holdmann commentedIt really helps!
just enable openssl module and get fun ;)
Comment #4
Golem07 commentedUnlike the original poster I already get this error when trying to add a twitter account to a user.
I am on a shared host so I do not think I am able to configure php :( But on the other hand I also do not get the report mentioned above. Instead my site reports: "Unexpected error: Unauthorized" (type: twitter).
Comment #5
Golem07 commentedSo I understand that the issue is closed.
Does this mean that I have no chance of running twitter on D7 any more so long as I am on a shared host? Just asking since "just enable openssl module and get fun ;)" is not a statement which I find very clear. Thanks in advance.
Comment #6
holdmann commentedHave you any errors in error.log file?
If it contents just error represented above, try this scenario:
Modify "modules/twitter/twitter.lib.php". you should delete or comment Exception wrapper __construct() method, like this
So, now you should get another error indicating the source of the problem. Paste it here and i'll try to help.
Comment #7
Golem07 commentedThank you very much holdmann!
This was exactly the hint that I needed since unlike before I was nowredirected to a twitter error page indicating a problem with some token. I was able to solve the problem by starting over on the twitter side of the setup. Without your modification I would still have expected the problem to be caused by my Drupal or server set up.
Comment #8
Bricks and Clicks MarketingI'm having this exact problem. After commenting the code you recommended, the error returns this:
Fatal error: Call to a member function get_auth() on a non-object in /home/warren/public_html/sites/all/modules/twitter/twitter.inc on line 12This error occurs when creating a node, which until now had been automatically posted to Twitter.
What I've done so far: I uninstalled & reconfigured the Twitter & Oauth modules. I also reset the keys in the Twitter application. Maybe something in Twitter's API changed?
Thanks!
Comment #9
csc4 commentedI don't understand - how can this be marked closed works by design when it's reporting an error with the parameters - surely it should have the right parameters, capture the error from Twitter and display it if it really 'works by design'?
Also I've got this problem too and it's taken down my cron which was working fine until I upgraded to 3.2 so I'm finding it hard to understand why a problem which wasn't fatal in 3.1 and is fatal in 3.2 'works by design'
If module OpenSSL is a dependency then shouldn't the project page say so, the documentation say os and shouldn't it be set as a dependency in the .info?
I've also looked and can find no module OpenSSL?
Comment #10
holdmann commentedOpenSSL is a php-extension.
It should be checked during module installation.
Comment #11
Bricks and Clicks MarketingThe problem I'm having is on a site where it was working and now is not. So it's not an issue of a problem during install. What's the solution then?
Comment #12
newad_fr commentedHi,
This may sounds obvious, but you must register your application first, otherwise you'll get the error. Navigate to the Twitter config page in your Drupal installation:
admin/config/services/twitter
You'll see a "register your application" link that will redirect you to Twitter. Fill up the form. Note that the "callback URL" you need to provide is listed in the Twitter config page of your Drupal site. Once the process is complete, copy/paste your "OAuth Consumer key" & "OAuth Consumer secret" back to your Drupal and voilà !!
Comment #13
Bricks and Clicks MarketingAll of that info is in there already and everything had been working fine - when an article was posted, a tweet went out. Now when an article is posted we get the fatal error I noted in comment #8.
Comment #14
mcartmel commentedAre you using PHP 5.2? This could possibly due to the fact that PHP < 5.3 only has two parameters to the Exception constructor.
Try this:
Comment #15
Bricks and Clicks MarketingThanks - where would I edit that?
Comment #16
stg11 commentedI'm running PHP 5.2 and getting the error. If PHP 5.3 is a requirement, this requirement should be listed on the project page.
Comment #17
stg11 commentedanswer to #15 is twitter.lib.php line 18
I changed as in #14 and now get
An error occurred when posting to Twitter: Read-only application cannot POST
Comment #18
stg11 commentedAfter changing access on Twitter to Read/Write I now get this
An error occurred when posting to Twitter: Could not authenticate with OAuth.
Comment #19
stg11 commentedI resolved #18 by clearing caches and deleting and re-adding my twitter account in Drupal. Posting successfully now.
Comment #20
Bricks and Clicks MarketingI did the fix in #14 (thanks stg11 for telling me where), cleared the cache & reset the oauth keys - now I get no errors when posting, but a tweet doesn't go out either.
Tried changing the application type in Twitter to read/write instead of just read, still no tweet going out. Tried changing the Twitter API link in Drupal from "https://api.twitter.com" to "https://api.twitter.com/1/" to match the Request URI in Twitter, still nothing. The node type (blog) is selected at /admin/config/services/twitter/post and the default string format is "New post: !title !tinyurl".
What should I try next?
Comment #21
Bricks and Clicks MarketingSome assistance please?
Comment #22
nobuyuki3 commented0、I don't know why, but the twitter Lobot remove my app setting from twitter webiste, so I registered my site again, and setting again.
1、I tried to change PHP ver from php5.2 to 5.3 using .htaccess.
2、I delete all the Cache on drupal site.
3、I removed my twitter account form my site, and re-add.
4、the last reason you should consider is, Callback URL, I use i18 for internationalization, it may effect for changing URL, then twitter aouth can not recognize URL collectly.
But the error is still remaining.....
Comment #23
syawillim commentedSame issue, everything was working fine yesterday. Added new content today and got the following "Fatal error: Wrong parameters for Exception([string $exception [, long $code ]]) in /home/...../...../sites/all/modules/twitter/twitter.lib.php on line 18".
Only change, yesterday updated to the following modules:
Comment #24
dwhutton commentedI have the same issue, which occurred out of the blue: one minute everything is working fine, the next minute I get the dreaded white screen every time a node attempts to post to Twitter.
No changes whatsoever were made in the codebase or the setup.
When I patch the code per #14 I get the message 'Unexpected error: Sorry, that page does not exist'. I'm re-saving an existing node and the log indicates that the save occurred normally.
Comment #25
nobuyuki3 commented#23
It may not the problem of the new modules, because I did not install any modules but the problem happened.
I noticed that I can not add any twitter account on my drupal site because of this error occured......omg
Comment #26
magpie5212 commentedSimilar to #24, I had a site which was working fine and then this started happening - the first time I noticed was when I got a call from one of my users late last night.
Comment #27
liliplanet commentedGot it fixed .. just reset the keys in your app, add the new settings to your twitter on drupal and all good :)
Comment #28
cbeier commentedSame here: A few days ago it was still working. Now there are only 500 errors when something is to do with the Twitter API.
In the last days, nothing has changed on this Drupal site (installed modules/updates, …)
Maybe Twitter has changed something …?
Comment #29
nobuyuki3 commented#28
yes, may be you re right.
Many users happened the problem "at the same time", it's quite strange.
Comment #30
artworker commentedHi guys,
I have the same error:
Fatal error: Wrong parameters for Exception([string $exception [, long $code ]]) in /home/magicgla/public_html/glasnovations.com/sites/all/modules/twitter/twitter.lib.php on line 18
Now my cron can't run.
If I re-register and reset the keys in the twitter module, can anyone confirm that that will fix it?
Comment #31
newad_fr commentedHi all,
I've tried all of the above suggestions, but I feel I'm moving from one error to another, without really knowing what's the problem/solution. Any real (reliable) solution from the developers? In the meantime, I disabled the module, cause it prevents cron from running correctly.
Comment #32
chris-cmfi commentedSame issue here. Had to disable the module because it disrupted cron.
Comment #33
robstead commentedSame here. Everything was working but now I get the 'wrong parameters' error. All the suggestions here haven't worked and I'm unaware of any changes at my end. A fix would be welcome.
Comment #34
Technikal commentedSme problem with me as well, CRON is gagging
Comment #35
dwhutton commentedWhat worked for me was to re-install Twitter and Oauth following the exact set of steps described in this post:
http://drupal.org/node/1361938#comment-5411616
Now everything is working fine.
Comment #36
Leeteq commentedCan anyone else confirm if they too get this fixed from the description mentioned in #35?
(And please confirm if you are running the latest -dev release or which version you are using.)
Quoting from there:
( #1361938: Not posting to Twitter )
(obviously, some steps are irrelevant for existing accounts, but seems like the point is to start fresh, test with a clean/new drupal site or uninstal/reinstall)
Comment #37
Leeteq commentedComment #38
dwhutton commentedI should have mentioned, the cause of this problem is apparently a change in Twitter's API -- which is why the problem just appeared out of the blue for many people. This is also why a clean install seems to be needed.
Comment #39
fizk commentedMarking duplicate of:
#1814642: Invalid handling of exceptions causes fatal errors on PHP5.2
#1814610: Use proper API URLs
Comment #40
laur3ntlapo commentedI have the same problem, tried all the solutions here and nothing worked. I have 5.2 and openssl enabled
Comment #41
barrabasah commentedme to
Wrong parameters for Exception([string $exception [, long $code ]])new instalationComment #42
kenyan commentedRe-opening.
I don't see how this is a duplicate of the 5.3 php check.
I running this dev version anf have followed all possible solutions on this page.
Thing is this error still shows up even when supposedly all fixes have been commited.
I'm running latest version Oauth too.
Comment #43
fizk commentedkenyan, are you running php 5.3?
Comment #44
xurizaemon@kenyan, "Fatal error: Wrong parameters for Exception" really is a dupe of #1814642: Invalid handling of exceptions causes fatal errors on PHP5.2. This error occurs only if the module is used on PHP5.2 or earlier and throws an exception.
I'm committing that solution shortly; please test the next available module release for the fix.
Comment #45
robstead commentedThank you. The latest update fixed the problem for me. It's much appreciated.
Comment #46
xurizaemonThank you for confirmation that the fix worked for you, Rob. It's always welcome.
Comment #47
kenyan commentedYou are correct. I was totally unaware my client was on 5.2 (my fault).
This fixes the issue.
Thanks much.