seen on Mahara 17.04 with an upgraded database and 1 Mahara 17.04 with a few users, but not on 17.10master with a fresh database
When going to the Web services logs, I get the following error message:
[WAR] 77 (lib/errors.php:859) Failed to get a recordset: postgres8 error: [-1: ERROR: syntax error at end of input
LINE 1: SELECT "displayname" FROM "institution" WHERE "name" = ?
^] in EXECUTE("SELECT "displayname" FROM "institution" WHERE "name" = ? ")Command was: SELECT "displayname" FROM "institution" WHERE "name" = ?
Call stack (most recent first):
log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /home/kristina/code/1704stable/htdocs/lib/errors.php:95
log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /home/kristina/code/1704stable/htdocs/lib/errors.php:859
SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /home/kristina/code/1704stable/htdocs/lib/dml.php:517
get_recordset_sql("SELECT "displayname" FROM "institution" WHERE "na...", false) at /home/kristina/code/1704stable/htdocs/lib/dml.php:828
get_field_sql("SELECT "displayname" FROM "institution" WHERE "na...", array(size 0)) at /home/kristina/code/1704stable/htdocs/lib/dml.php:816
get_field("institution", "displayname", "name", null) at /home/kristina/code/1704stable/htdocs/lib/institution.php:997
institution_display_name(null) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicessearchlib.php:222
get_log_search_results(object(stdClass)) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicessearchlib.php:39
build_webservice_log_search_results(object(stdClass)) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicelogs.php:53
[WAR] 77 (lib/dml.php:517) Failed to get a recordset: postgres8 error: [-1: ERROR: syntax error at end of input
LINE 1: SELECT "displayname" FROM "institution" WHERE "name" = ?
^] in EXECUTE("SELECT "displayname" FROM "institution" WHERE "name" = ? ")Command was: SELECT "displayname" FROM "institution" WHERE "name" = ?
Call stack (most recent first):
get_recordset_sql("SELECT "displayname" FROM "institution" WHERE "na...", false) at /home/kristina/code/1704stable/htdocs/lib/dml.php:828
get_field_sql("SELECT "displayname" FROM "institution" WHERE "na...", array(size 0)) at /home/kristina/code/1704stable/htdocs/lib/dml.php:816
get_field("institution", "displayname", "name", null) at /home/kristina/code/1704stable/htdocs/lib/institution.php:997
institution_display_name(null) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicessearchlib.php:222
get_log_search_results(object(stdClass)) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicessearchlib.php:39
build_webservice_log_search_results(object(stdClass)) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicelogs.php:53
I did a quick analysis.
A record is getting inserted into the external_ services_ logs table with institution = "".
Which means, that the $WEBSERVICE_ INSTITUTION variable is not getting set correctly when the user is getting authenticated.
There are 3 places where this happens: webservice/ lib.php: authenticate_ user() line 946 <- not the issue as all data is correct in the usr / usr_institution tables.
1. htdocs/
2. htdocs/ webservice/ lib.php: authenticate_ user() line 1001 <- not likely.
3. htdocs/ webservice/ lib.php: authenticate_ by_token( ) line 1084 <- most likely is the issue.
I think it's in the authenticate_ by_token( ) because when I did a query of the external_tokens table, the institution field was empty (not null but "").
It would be good to know the steps used when accessing the site via the webservice.