mashaurudin / oauth-php

Automatically exported from code.google.com/p/oauth-php
MIT License
0 stars 0 forks source link

OAuthStoreSQL->addServerToken does not use consumers registered with ocr_usa_id_ref=null #113

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Register server as admin and userid=NULL (public) with:

$server = array (
  'consumer_key'    => '...', [...]
  'user_id'     => NULL
);
$key   = $store->updateServer($server, $user_id, true);

2. Start authorization with $token = 
OAuthRequester::requestRequestToken($consumer_key, $user_id);

3. Requests fails and log shows:
[Thu Jun 02 03:03:22 2011] [error] [client 192.168.0.105] PHP Fatal error:  
Uncaught exception 'OAuthException2' with message 'No server associated with 
consumer_key "2b098765...98e7956fb704de2ba5b"' in 
/var/www/testwebapp/classes/oauth/store/OAuthStoreSQL.php:345\nStack trace:\n#0 
/var/www/testwebapp/classes/oauth/OAuthRequester.php(190): 
OAuthStoreSQL->addServerToken('2b02f7bc8c6d594...', 'request', 
'6ece90050eed4f5...', 'e25be55d5db783b...', '1', Array)\n#1 
/var/www/testwebapp/request_token.php(28): 
OAuthRequester::requestRequestToken('2b02f7bc8c6d594...', '1')\n#2 {main}\n  
thrown in /var/www/testwebapp/classes/oauth/store/OAuthStoreSQL.php on line 
345, referer: http://.../testwebapp/home.php

What is the expected output? What do you see instead?

The obtained request token should be stored on oauth_consumer_token table.
Instead of that request fails.

What version of the product are you using? On what operating system?
oauth-php-175 on Linux ubuntu 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 
14:17:33 UTC 2010 i686 GNU/Linux

Please provide any additional information below.

The problem can be solved modifying OAuthStoreSQL.php
On line 329 and 341 replacing
ocr_usa_id_ref = %d
with
(ocr_usa_id_ref = \'%d\' OR ocr_usa_id_ref IS NULL)

Best regards,
Eric Janz

Original issue reported on code.google.com by ericj...@gmail.com on 1 Jun 2011 at 11:55