Forums | Mahara Community

Support /
Removing access rights creates error


Patric Lougheed's profile picture
Posts: 97

05 May 2020, 10:03

Just upgraded from 19.04 to 19.10.3 and now when I try to remove public access rights on my profile page I get these errors.

[WAR] 0d (lib/view.php:1345) Undefined index: id

Call stack (most recent first):

  • log_message("Undefined index: id", 8, true, true, "/var/www/lib/view.php", 1345) at /var/www/lib/errors.php:521

  • error(8, "Undefined index: id", "/var/www/lib/view.php", 1345, array(size 11)) at /var/www/lib/view.php:1345

  • View->set_access(array(size 3), array(size 1), "1") at /var/www/lib/view.php:1121

  • View::update_view_access(array(size 7), array(size 1)) at /var/www/view/accessurl.php:499

  • accessurl_submit(object(Pieform), array(size 12)) at /var/www/lib/pieforms/pieform.php:546

  • Pieform->__construct(array(size 9)) at /var/www/lib/pieforms/pieform.php:168

  • Pieform::process(array(size 9)) at /var/www/lib/mahara.php:5441

  • pieform(array(size 9)) at /var/www/view/accessurl.php:524

[WAR] 0d (lib/adodb/adodb-exceptions.inc.php:45) Array to string conversion

Call stack (most recent first):

  • log_message("Array to string conversion", 8, true, true, "/var/www/lib/adodb/adodb-excepti...", 45) at /var/www/lib/errors.php:521

  • error(8, "Array to string conversion", "/var/www/lib/adodb/adodb-excepti...", 45, array(size 7)) at /var/www/lib/adodb/adodb-exceptions.inc.php:45

  • ADODB_Exception->__construct("postgres8", "adodb_throw", -1, "ERROR: new row for relation "view_access" violate...", "INSERT INTO "view_access" ("view", "allowcomments"...", array(size 5), object(ADODB_postgres8)) at /var/www/lib/adodb/adodb-exceptions.inc.php:80

  • adodb_throw("postgres8", "adodb_throw", -1, "ERROR: new row for relation "view_access" violate...", "INSERT INTO "view_access" ("view", "allowcomments"...", array(size 5), object(ADODB_postgres8)) at /var/www/lib/adodb/adodb.inc.php:310

  • ADODB_TransMonitor("postgres8", "adodb_throw", -1, "ERROR: new row for relation "view_access" violate...", "INSERT INTO "view_access" ("view", "allowcomments"...", array(size 5), object(ADODB_postgres8)) at /var/www/lib/adodb/adodb.inc.php:1281

  • ADOConnection->_Execute("INSERT INTO "view_access" ("view", "allowcomments"...", array(size 5)) at /var/www/lib/adodb/adodb.inc.php:1241

  • ADOConnection->Execute("INSERT INTO "view_access" ("view", "allowcomments"...", array(size 5)) at /var/www/lib/dml.php:1229

  • insert_record("view_access", object(stdClass), "id", true) at /var/www/lib/view.php:1372

  • View->set_access(array(size 3), array(size 1), "1") at /var/www/lib/view.php:1121

  • View::update_view_access(array(size 7), array(size 1)) at /var/www/view/accessurl.php:499

  • accessurl_submit(object(Pieform), array(size 12)) at /var/www/lib/pieforms/pieform.php:546

  • Pieform->__construct(array(size 9)) at /var/www/lib/pieforms/pieform.php:168

  • Pieform::process(array(size 9)) at /var/www/lib/mahara.php:5441

  • pieform(array(size 9)) at /var/www/view/accessurl.php:524

[WAR] 0d (lib/errors.php:859) Failed to get a recordset: postgres8 error: [-1: ERROR:  new row for relation "view_access" violates check constraint "view_access_check"
DETAIL:  Failing row contains (18, null, null, null, null, null, null, 1, null, null, 0, 1, 2020-05-04 14:46:19, 35781).] in adodb_throw(INSERT INTO "view_access" ("view", "allowcomments", "approvecomments", "ctime", "id") VALUES (?, ?, ?, ?, ?), Array)Command was: INSERT INTO "view_access" ("view", "allowcomments", "approvecomments", "ctime", "id") VALUES (?, ?, ?, ?, ?) and values was (view:18,allowcomments:0,approvecomments:1,ctime:2020-05-0414:46:19,id:35781)


Call stack (most recent first):

  • log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /var/www/lib/errors.php:95

  • log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/lib/errors.php:859

  • SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/lib/dml.php:1232

  • insert_record("view_access", object(stdClass), "id", true) at /var/www/lib/view.php:1372

  • View->set_access(array(size 3), array(size 1), "1") at /var/www/lib/view.php:1121

  • View::update_view_access(array(size 7), array(size 1)) at /var/www/view/accessurl.php:499

  • accessurl_submit(object(Pieform), array(size 12)) at /var/www/lib/pieforms/pieform.php:546

  • Pieform->__construct(array(size 9)) at /var/www/lib/pieforms/pieform.php:168

  • Pieform::process(array(size 9)) at /var/www/lib/mahara.php:5441

  • pieform(array(size 9)) at /var/www/view/accessurl.php:524

[WAR] 0d (lib/dml.php:1232) Failed to get a recordset: postgres8 error: [-1: ERROR:  new row for relation "view_access" violates check constraint "view_access_check"
DETAIL:  Failing row contains (18, null, null, null, null, null, null, 1, null, null, 0, 1, 2020-05-04 14:46:19, 35781).] in adodb_throw(INSERT INTO "view_access" ("view", "allowcomments", "approvecomments", "ctime", "id") VALUES (?, ?, ?, ?, ?), Array)Command was: INSERT INTO "view_access" ("view", "allowcomments", "approvecomments", "ctime", "id") VALUES (?, ?, ?, ?, ?) and values was (view:18,allowcomments:0,approvecomments:1,ctime:2020-05-0414:46:19,id:35781)


Call stack (most recent first):

  • insert_record("view_access", object(stdClass), "id", true) at /var/www/lib/view.php:1372

  • View->set_access(array(size 3), array(size 1), "1") at /var/www/lib/view.php:1121

  • View::update_view_access(array(size 7), array(size 1)) at /var/www/view/accessurl.php:499

  • accessurl_submit(object(Pieform), array(size 12)) at /var/www/lib/pieforms/pieform.php:546

  • Pieform->__construct(array(size 9)) at /var/www/lib/pieforms/pieform.php:168

  • Pieform::process(array(size 9)) at /var/www/lib/mahara.php:5441

  • pieform(array(size 9)) at /var/www/view/accessurl.php:524

 

Robert Lyon's profile picture
Posts: 757

06 May 2020, 12:16

Hi Patric,

I was not able to replicate this issue.

Can you fetch the existing information from db for view and view_access for view = 18, eg:

SELECT * FROM view WHERE id = 18;

SELECT * FROM view_access WHERE view = 18;

So I can try and replicate the problem you are having

Cheers

Robert

Patric Lougheed's profile picture
Posts: 97
Robert Lyon's profile picture
Posts: 757

07 May 2020, 8:14

Hi Patric

Thank you for that data, I tried setting up a user with similar data but was not able to replicate the error - so the data in the database looks correct.

So I'm wondering if there is something odd about the access page form and it's saving.

Can you let me know which page access form you are using (there are two) by copying the URL here.

And if you can view the 'console' tab of the browser (eg in Firefox hit F12 button) to let me know if there are any javascript errors on the page.

And if you can do a screenshot of the page I can check if the form looks broken for some reason.

Cheers

Robert

Patric Lougheed's profile picture
Posts: 97

07 May 2020, 9:59

Sure,

I am editing in /view/accessurl.php?id=18 and I just noticed my institutions do not display correctly here:

screenshot-folioz.ca-2020.05.06-14_52_57.jpg

But on the share.php page they do:

screenshot-folioz.ca-2020.05.06-14_53_44.jpg

I checked my other demo accounts and they work as expected. There are no javascript errors just the good old "nonrecoverable error occurred" message.

Patric Lougheed's profile picture
Posts: 97

07 May 2020, 10:31

I think there is a missing row as I do not see a Registered User row in the database which I think is id 35786 that the error refers to which is not in the view access table. 

Robert Lyon's profile picture
Posts: 757

07 May 2020, 12:06

The problem I suspect is the brokenness of the page / form as it is trying to insert a row but the accesstype / group / usr / institution / token columns are all empty for that row insertion and so complains about the 'view_access_check' where it expects at least one of them to be not null.

And I think it is trying to do that due to those institution rows not being displayed correctly

I will do some further investigation and get back to you

Patric Lougheed's profile picture
Posts: 97

08 May 2020, 8:00

Thanks,

Tried to manually add row and got:

ERROR: new row for relation "view_access" violates check constraint "view_access_check" DETAIL: Failing row contains (18, null, null, null, null, null, null, 1, null, null, 0, 1, 2015-05-13 16:33:38, 35786)

8 results