Closed (fixed)
Project:
Flickr API
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Apr 2012 at 19:19 UTC
Updated:
4 Jan 2014 at 01:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
BarisW commentedAnd I get this message also:
Any thoughts?
Comment #2
BarisW commentedI debugged a bit more and found out that it might be caused by the variables declaration in class DrupalOAuthToken:
if I change this to
All works fine. Can a static be used like this?
Comment #3
BarisW commentedWhat started as a support request actually is a bug report.
Comment #4
BarisW commentedSteps to reproduce:
- Install FlickrAPI 7.x-1.3
- Go to admin/config/media/flickrapi, fill in Flickr keys and click Authenticate. If you don't have a key and secret contact me and I will send you mine.
- Authenticate to Flickr using OAuth (happens when you save the admin form).
You'll see the notice.
I spoke to juampy on IRC and this was what he said:
All help here is welcome!
Comment #5
juampynr commentedThis is a weird one. Basically, some OAuth classes are getting registered at cache_bootstrap table under lookup_cache cid. These classes are being loaded before oauth_common.module, hence the error.
I need to discover at what point does this happens and how to avoid it. For that, I will trace a full OAuth authentication process to see what is going on on each step.
Here is an example of my cache_bootstrap table after authenticating. See how these classes got registered. These classes are loaded very early in the bootstrap process.
Comment #6
BarisW commentedDid you happen to do this yet? It really is an annoying issue, as all sites that rely on the FlickrAPi module (and submodules like FlickrGallery) will see this error/notice once they use the OAuth authentication.
Is there anything I can do in my module to work around this?
Comment #7
juampynr commentedI worked on it yesterday and I am not certain of what is going on yet. I was actually reading at how Flickrapi module creates the request token. It seems that info about class DrupalOAuthClient is saved in lookup_cache at drupal_goto() (which saves the user session to database). Twitter module, for example, uses OAuth as well but does not have this problem.
I will work on this a little bit more and hopefully find a fix in OAuth or a patch for Flickrapi.
Comment #8
juampynr commentedMoved to Flickrapi module.
The problem comes because the full DrupalOAuthToken object returned from Flickr was being saved using variable_set(). Then drupal_goto() provokes that saved variables get stored at cache_bootstrap table, which finally raises an error for every following page because when this variable is loaded, the class DrupalOAuthToken has not being loaded yet.
I have removed this object from being saved an created a private callback to check if a Flickr account has been authenticated instead.
Please review the suggested patch and consider Git Attribution.
Comment #9
BarisW commentedAwesome Juan! Thanks a lot for the research and the patch.
Committed, with git attribution (of course).