Hello!
I'm getting an exception PDOException: SQLSTATE[22P02] when viewing page /user/1 if I check OAuth Provider UI checkbox on admin/modules page.
The full text of exception is
PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "" LINE 5: WHERE (c.csid = '') ^: SELECT c.csid AS csid, c.consumer_key AS consumer_key, c.secret AS secret, c.configuration AS configuration, pc.created AS created, pc.changed AS changed, pc.uid AS uid, pc.name AS name, pc.context AS context, pc.callback_url AS callback_url FROM {oauth_common_consumer} c LEFT OUTER JOIN {oauth_common_provider_consumer} pc ON pc.csid = c.csid WHERE (c.csid = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => ) in function DrupalOAuthConsumer::loadById() (line 174 in ***/drupal7/sites/all/modules/oauth/includes/DrupalOAuthConsumer.inc).
Indeed, empty string is passed as csid in this function. Function from menu.inc file generate such a call, and the direct caller is _menu_load_objects (menu.inc:579). Empty string is generated in menu.inc:549 because unserialized $load_functions has keys 1 and 4 but $map has keys 0 and 1 only. This comes from the bunch of menu.inc functions and I did not realize how did they bulid such an uncoordination between this two parameters.
Backtrace follows. What additional debug data could I provide? Drupal v7.8 BTW.
--- begin backtrace ---
array(18) {
[0]=>
array(6) {
["file"]=>
string(66) "/var/www/***/drupal7/sites/all/modules/oauth/oauth_common.module"
["line"]=>
int(147)
["function"]=>
string(8) "loadById"
["class"]=>
string(19) "DrupalOAuthConsumer"
["type"]=>
string(2) "::"
["args"]=>
array(2) {
[0]=>
&string(0) ""
[1]=>
&bool(true)
}
}
[1]=>
array(4) {
["file"]=>
string(40) "/var/www/***/drupal7/includes/menu.inc"
["line"]=>
int(581)
["function"]=>
string(26) "oauth_common_consumer_load"
["args"]=>
array(1) {
[0]=>
&string(0) ""
}
}
[2]=>
array(4) {
["file"]=>
string(40) "/var/www/***/drupal7/includes/menu.inc"
["line"]=>
int(748)
["function"]=>
string(18) "_menu_load_objects"
["args"]=>
array(2) {
[0]=>
&array(23) {
["path"]=>
string(41) "user/%/oauth/consumer/%/add-authorization"
["load_functions"]=>
string(64) "a:2:{i:1;s:9:"user_load";i:4;s:26:"oauth_common_consumer_load";}"
["to_arg_functions"]=>
string(0) ""
["access_callback"]=>
string(35) "oauth_common_can_authorize_consumer"
["access_arguments"]=>
string(14) "a:1:{i:0;i:4;}"
["page_callback"]=>
string(30) "oauth_common_authorization_add"
["page_arguments"]=>
string(14) "a:1:{i:0;i:4;}"
["delivery_callback"]=>
string(0) ""
["fit"]=>
string(2) "45"
["number_parts"]=>
string(1) "6"
["context"]=>
string(1) "1"
["tab_parent"]=>
string(23) "user/%/oauth/consumer/%"
["tab_root"]=>
string(6) "user/%"
["title"]=>
string(17) "Add authorization"
["title_callback"]=>
string(1) "t"
["title_arguments"]=>
string(0) ""
["theme_callback"]=>
string(0) ""
["theme_arguments"]=>
string(6) "a:0:{}"
["type"]=>
string(3) "132"
["description"]=>
string(0) ""
["position"]=>
string(0) ""
["weight"]=>
string(1) "0"
["include_file"]=>
string(55) "sites/all/modules/oauth/oauth_common.authorizations.inc"
}
[1]=>
&array(2) {
[0]=>
string(4) "user"
[1]=>
object(stdClass)#91 (19) {
["uid"]=>
string(1) "1"
["name"]=>
string(5) "admin"
["pass"]=>
string(55) "***"
["mail"]=>
string(17) "***"
["theme"]=>
string(0) ""
["signature"]=>
string(0) ""
["signature_format"]=>
NULL
["created"]=>
string(10) "1318314236"
["access"]=>
string(10) "1318706046"
["login"]=>
string(10) "1318606137"
["status"]=>
string(1) "1"
["timezone"]=>
NULL
["language"]=>
string(0) ""
["picture"]=>
NULL
["init"]=>
string(17) "***"
["data"]=>
bool(false)
["roles"]=>
array(2) {
[2]=>
string(18) "authenticated user"
[3]=>
string(13) "administrator"
}
["rdf_mapping"]=>
array(3) {
["rdftype"]=>
array(1) {
[0]=>
string(16) "sioc:UserAccount"
}
["name"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(9) "foaf:name"
}
}
["homepage"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(9) "foaf:page"
}
["type"]=>
string(3) "rel"
}
}
["entity_view_prepared"]=>
bool(true)
}
}
}
}
[3]=>
array(4) {
["file"]=>
string(40) "/var/www/***/drupal7/includes/menu.inc"
["line"]=>
int(1865)
["function"]=>
string(15) "_menu_translate"
["args"]=>
array(3) {
[0]=>
&array(23) {
["path"]=>
string(41) "user/%/oauth/consumer/%/add-authorization"
["load_functions"]=>
string(64) "a:2:{i:1;s:9:"user_load";i:4;s:26:"oauth_common_consumer_load";}"
["to_arg_functions"]=>
string(0) ""
["access_callback"]=>
string(35) "oauth_common_can_authorize_consumer"
["access_arguments"]=>
string(14) "a:1:{i:0;i:4;}"
["page_callback"]=>
string(30) "oauth_common_authorization_add"
["page_arguments"]=>
string(14) "a:1:{i:0;i:4;}"
["delivery_callback"]=>
string(0) ""
["fit"]=>
string(2) "45"
["number_parts"]=>
string(1) "6"
["context"]=>
string(1) "1"
["tab_parent"]=>
string(23) "user/%/oauth/consumer/%"
["tab_root"]=>
string(6) "user/%"
["title"]=>
string(17) "Add authorization"
["title_callback"]=>
string(1) "t"
["title_arguments"]=>
string(0) ""
["theme_callback"]=>
string(0) ""
["theme_arguments"]=>
string(6) "a:0:{}"
["type"]=>
string(3) "132"
["description"]=>
string(0) ""
["position"]=>
string(0) ""
["weight"]=>
string(1) "0"
["include_file"]=>
string(55) "sites/all/modules/oauth/oauth_common.authorizations.inc"
}
[1]=>
&array(2) {
[0]=>
string(4) "user"
[1]=>
string(1) "1"
}
[2]=>
&bool(true)
}
}
[4]=>
array(4) {
["file"]=>
string(40) "/var/www/***/drupal7/includes/menu.inc"
["line"]=>
int(2170)
["function"]=>
string(16) "menu_local_tasks"
["args"]=>
array(0) {
}
}
[5]=>
array(4) {
["file"]=>
string(40) "/var/www/***/drupal7/includes/menu.inc"
["line"]=>
int(1633)
["function"]=>
string(18) "menu_tab_root_path"
["args"]=>
array(0) {
}
}
[6]=>
array(4) {
["file"]=>
string(51) "/var/www/***/drupal7/modules/system/system.module"
["line"]=>
int(2059)
["function"]=>
string(20) "menu_get_active_help"
["args"]=>
array(0) {
}
}
[7]=>
array(2) {
["function"]=>
string(17) "system_block_view"
["args"]=>
array(1) {
[0]=>
&string(4) "help"
}
}
[8]=>
array(4) {
["file"]=>
string(42) "/var/www/***/drupal7/includes/module.inc"
["line"]=>
int(795)
["function"]=>
string(20) "call_user_func_array"
["args"]=>
array(2) {
[0]=>
&string(17) "system_block_view"
[1]=>
&array(1) {
[2]=>
string(4) "help"
}
}
}
[9]=>
array(4) {
["file"]=>
string(49) "/var/www/***/drupal7/modules/block/block.module"
["line"]=>
int(834)
["function"]=>
string(13) "module_invoke"
["args"]=>
array(3) {
[0]=>
&string(6) "system"
[1]=>
&string(10) "block_view"
[2]=>
&string(4) "help"
}
}
[10]=>
array(4) {
["file"]=>
string(49) "/var/www/***/drupal7/modules/block/block.module"
["line"]=>
int(658)
["function"]=>
string(20) "_block_render_blocks"
["args"]=>
array(1) {
[0]=>
&array(1) {
["system_help"]=>
object(stdClass)#99 (12) {
["bid"]=>
string(3) "111"
["module"]=>
string(6) "system"
["delta"]=>
string(4) "help"
["theme"]=>
string(4) "mayo"
["status"]=>
string(1) "1"
["weight"]=>
string(1) "0"
["region"]=>
string(4) "help"
["custom"]=>
string(1) "0"
["visibility"]=>
string(1) "0"
["pages"]=>
string(0) ""
["title"]=>
string(0) ""
["cache"]=>
string(2) "-1"
}
}
}
}
[11]=>
array(4) {
["file"]=>
string(49) "/var/www/***/drupal7/modules/block/block.module"
["line"]=>
int(315)
["function"]=>
string(10) "block_list"
["args"]=>
array(1) {
[0]=>
&string(4) "help"
}
}
[12]=>
array(4) {
["file"]=>
string(49) "/var/www/***/drupal7/modules/block/block.module"
["line"]=>
int(268)
["function"]=>
string(26) "block_get_blocks_by_region"
["args"]=>
array(1) {
[0]=>
&string(4) "help"
}
}
[13]=>
array(4) {
["file"]=>
string(42) "/var/www/***/drupal7/includes/common.inc"
["line"]=>
int(5497)
["function"]=>
string(16) "block_page_build"
["args"]=>
array(1) {
[0]=>
&array(4) {
["#show_messages"]=>
bool(true)
["#theme"]=>
string(4) "page"
["#theme_wrappers"]=>
array(1) {
[0]=>
string(4) "html"
}
["#type"]=>
string(4) "page"
}
}
}
[14]=>
array(4) {
["file"]=>
string(42) "/var/www/***/drupal7/includes/common.inc"
["line"]=>
int(2542)
["function"]=>
string(18) "drupal_render_page"
["args"]=>
array(1) {
[0]=>
&array(9) {
["#pre_render"]=>
array(1) {
[0]=>
string(30) "_field_extra_fields_pre_render"
}
["#entity_type"]=>
string(4) "user"
["#bundle"]=>
string(4) "user"
["user_picture"]=>
array(2) {
["#markup"]=>
string(0) ""
["#weight"]=>
int(-10)
}
["summary"]=>
array(5) {
["#type"]=>
string(21) "user_profile_category"
["#attributes"]=>
array(1) {
["class"]=>
array(1) {
[0]=>
string(11) "user-member"
}
}
["#weight"]=>
int(5)
["#title"]=>
string(14) "История"
["member_for"]=>
array(3) {
["#type"]=>
string(17) "user_profile_item"
["#title"]=>
string(16) "Участник"
["#markup"]=>
string(22) "4 дня 12 часов"
}
}
["#theme"]=>
string(12) "user_profile"
["#account"]=>
object(stdClass)#91 (19) {
["uid"]=>
string(1) "1"
["name"]=>
string(5) "admin"
["pass"]=>
string(55) "***"
["mail"]=>
string(17) "***"
["theme"]=>
string(0) ""
["signature"]=>
string(0) ""
["signature_format"]=>
NULL
["created"]=>
string(10) "1318314236"
["access"]=>
string(10) "1318706046"
["login"]=>
string(10) "1318606137"
["status"]=>
string(1) "1"
["timezone"]=>
NULL
["language"]=>
string(0) ""
["picture"]=>
NULL
["init"]=>
string(17) "***"
["data"]=>
bool(false)
["roles"]=>
array(2) {
[2]=>
string(18) "authenticated user"
[3]=>
string(13) "administrator"
}
["rdf_mapping"]=>
array(3) {
["rdftype"]=>
array(1) {
[0]=>
string(16) "sioc:UserAccount"
}
["name"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(9) "foaf:name"
}
}
["homepage"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(9) "foaf:page"
}
["type"]=>
string(3) "rel"
}
}
["entity_view_prepared"]=>
bool(true)
}
["#view_mode"]=>
string(4) "full"
["#language"]=>
string(2) "ru"
}
}
}
[15]=>
array(4) {
["file"]=>
string(42) "/var/www/***/drupal7/includes/common.inc"
["line"]=>
int(2437)
["function"]=>
string(24) "drupal_deliver_html_page"
["args"]=>
array(1) {
[0]=>
&array(9) {
["#pre_render"]=>
array(1) {
[0]=>
string(30) "_field_extra_fields_pre_render"
}
["#entity_type"]=>
string(4) "user"
["#bundle"]=>
string(4) "user"
["user_picture"]=>
array(2) {
["#markup"]=>
string(0) ""
["#weight"]=>
int(-10)
}
["summary"]=>
array(5) {
["#type"]=>
string(21) "user_profile_category"
["#attributes"]=>
array(1) {
["class"]=>
array(1) {
[0]=>
string(11) "user-member"
}
}
["#weight"]=>
int(5)
["#title"]=>
string(14) "История"
["member_for"]=>
array(3) {
["#type"]=>
string(17) "user_profile_item"
["#title"]=>
string(16) "Участник"
["#markup"]=>
string(22) "4 дня 12 часов"
}
}
["#theme"]=>
string(12) "user_profile"
["#account"]=>
object(stdClass)#91 (19) {
["uid"]=>
string(1) "1"
["name"]=>
string(5) "admin"
["pass"]=>
string(55) "***"
["mail"]=>
string(17) "***"
["theme"]=>
string(0) ""
["signature"]=>
string(0) ""
["signature_format"]=>
NULL
["created"]=>
string(10) "1318314236"
["access"]=>
string(10) "1318706046"
["login"]=>
string(10) "1318606137"
["status"]=>
string(1) "1"
["timezone"]=>
NULL
["language"]=>
string(0) ""
["picture"]=>
NULL
["init"]=>
string(17) "***"
["data"]=>
bool(false)
["roles"]=>
array(2) {
[2]=>
string(18) "authenticated user"
[3]=>
string(13) "administrator"
}
["rdf_mapping"]=>
array(3) {
["rdftype"]=>
array(1) {
[0]=>
string(16) "sioc:UserAccount"
}
["name"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(9) "foaf:name"
}
}
["homepage"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(9) "foaf:page"
}
["type"]=>
string(3) "rel"
}
}
["entity_view_prepared"]=>
bool(true)
}
["#view_mode"]=>
string(4) "full"
["#language"]=>
string(2) "ru"
}
}
}
[16]=>
array(4) {
["file"]=>
string(40) "/var/www/***/drupal7/includes/menu.inc"
["line"]=>
int(520)
["function"]=>
string(19) "drupal_deliver_page"
["args"]=>
array(2) {
[0]=>
&array(9) {
["#pre_render"]=>
array(1) {
[0]=>
string(30) "_field_extra_fields_pre_render"
}
["#entity_type"]=>
string(4) "user"
["#bundle"]=>
string(4) "user"
["user_picture"]=>
array(2) {
["#markup"]=>
string(0) ""
["#weight"]=>
int(-10)
}
["summary"]=>
array(5) {
["#type"]=>
string(21) "user_profile_category"
["#attributes"]=>
array(1) {
["class"]=>
array(1) {
[0]=>
string(11) "user-member"
}
}
["#weight"]=>
int(5)
["#title"]=>
string(14) "История"
["member_for"]=>
array(3) {
["#type"]=>
string(17) "user_profile_item"
["#title"]=>
string(16) "Участник"
["#markup"]=>
string(22) "4 дня 12 часов"
}
}
["#theme"]=>
string(12) "user_profile"
["#account"]=>
object(stdClass)#91 (19) {
["uid"]=>
string(1) "1"
["name"]=>
string(5) "admin"
["pass"]=>
string(55) "***"
["mail"]=>
string(17) "***"
["theme"]=>
string(0) ""
["signature"]=>
string(0) ""
["signature_format"]=>
NULL
["created"]=>
string(10) "1318314236"
["access"]=>
string(10) "1318706046"
["login"]=>
string(10) "1318606137"
["status"]=>
string(1) "1"
["timezone"]=>
NULL
["language"]=>
string(0) ""
["picture"]=>
NULL
["init"]=>
string(17) "***"
["data"]=>
bool(false)
["roles"]=>
array(2) {
[2]=>
string(18) "authenticated user"
[3]=>
string(13) "administrator"
}
["rdf_mapping"]=>
array(3) {
["rdftype"]=>
array(1) {
[0]=>
string(16) "sioc:UserAccount"
}
["name"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(9) "foaf:name"
}
}
["homepage"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(9) "foaf:page"
}
["type"]=>
string(3) "rel"
}
}
["entity_view_prepared"]=>
bool(true)
}
["#view_mode"]=>
string(4) "full"
["#language"]=>
string(2) "ru"
}
[1]=>
&string(0) ""
}
}
[17]=>
array(4) {
["file"]=>
string(32) "/var/www/***/drupal7/index.php"
["line"]=>
int(21)
["function"]=>
string(27) "menu_execute_active_handler"
["args"]=>
array(0) {
}
}
}
--- end backtrace ---
However, this bug makes user/1 page unviewable, is major priority OK for it?
Comment | File | Size | Author |
---|---|---|---|
#9 | oauth_1310984.patch | 1.81 KB | aadityawalawalkar |
Comments
Comment #1
pdragon04 CreditAttribution: pdragon04 commentedAlso having this same issue now in alpha 2 and with Drupal 7.10
Comment #2
wedge CreditAttribution: wedge commentedSame issue here. Running PostgreSQL if that make any difference.
Comment #3
webkomplize CreditAttribution: webkomplize commentedSame issue if visiting user/1/edit?destination=admin/people
Drupal 7.14
OAuth 7.x-3.0
Services 7.x-3.1+60-dev
PostgreSQL 9.1.1
PHP 5.3.2
Comment #4
spoco2 CreditAttribution: spoco2 commentedSame issue when trying to view /user/3/oauth/consumer/add or user/3, or pretty much any page pertaining to a user when OAuth Provider UI module is enabled.
Really, really killing my ability to do, well, anything right now with OAuth.
Also using Postgresql. So I'm thinking it's an issue with Drupal/this module and postgresql
Full error I get with above:
Error I get if I just try to view the user page: /user/3/
Comment #5
spoco2 CreditAttribution: spoco2 commentedUpdating to priority critical as I can't use a single feature of OAuth without being able to add users as consumers
Comment #6
spoco2 CreditAttribution: spoco2 commentedI can confirm that this is a bug that manifests when PostgreSQL is the database in use only.
I've run up another install of Drupal using mySQL and the problem is gone.
Comment #7
Leeteq CreditAttribution: Leeteq commentedComment #8
brylie CreditAttribution: brylie commentedSame issue here.
Drupal 7.16
PHP 5.4.8
PostgreSQL 9.1.0
OAuth 7.x-3.0
Error:
Invalid text representation: 7 ERROR: invalid input syntax for integer: "" LINE 5: WHERE (c.csid = '') ^: SELECT c.csid AS csid, c.consumer_key AS consumer_key, c.secret AS secret, c.configuration AS configuration, pc.created AS created, pc.changed AS changed, pc.uid AS uid, pc.name AS name, pc.context AS context, pc.callback_url AS callback_url FROM {oauth_common_consumer} c LEFT OUTER JOIN {oauth_common_provider_consumer}
Comment #9
aadityawalawalkar CreditAttribution: aadityawalawalkar commentedApply this patch to fix the above errors.
This patch handles two things:-
1) Call to functions DrupalOAuthToken::loadByID($tid); & DrupalOAuthConsumer::loadById($csid, TRUE); only if $tid & $csid is not empty.
2) Exection of query only if valid token id , consumer id is passed to public static function loadById($tid, $load_provider_data = TRUE) & public static function loadById($csid, $load_provider_data = TRUE) respectively.
Comment #10
rjbrown99 CreditAttribution: rjbrown99 commentedPatch here, changing status.
Comment #11
Ben Coleman CreditAttribution: Ben Coleman commentedSame issue here
Drupal 7.23
PHP 5.3.10
PostgreSQL 9.1.9
OAuth 7.x-3.1
Patch in #9 fixes this.
Comment #12
juampynr CreditAttribution: juampynr commentedCommitted. Thanks!