← Back to team overview

mahara-contributors team mailing list archive

[Bug 1749402] Re: Views and collection list (in group) throws MySQL error

 

** Changed in: mahara/17.10
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1749402

Title:
  Views and collection list (in group) throws MySQL error

Status in Mahara:
  Fix Released
Status in Mahara 17.10 series:
  Fix Released
Status in Mahara 18.04 series:
  Fix Released
Status in Mahara 18.10 series:
  Fix Committed

Bug description:
  If a normal group member tries to visit views and collections of the
  group, following warning/error is thrown under some conditions which
  are mentioned below:

  SQL:
  [WAR] 93 (lib/errors.php:859) Failed to get a recordset: mysqli error: [1452: Cannot add or update a child row: a foreign key constraint fails ("dp-dev-master-ep"."view_rows_columns", CONSTRAINT "viewrowscolu_vie_fk" FOREIGN KEY ("view") REFERENCES "view" ("id"))] in EXECUTE("INSERT INTO "view_rows_columns" ("view", "row", "columns") VALUES ('46', '1', '3')")Command was: INSERT INTO "view_rows_columns" ("view", "row", "columns") VALUES (?, ?, ?) and values was (view:46,row:1,columns:3)

  PHP:
  Call stack (most recent first):
  log_message("Failed to get a recordset: mysqli error: [1452: Ca...", 8, true, true) at /var/www/mahara/master/htdocs/lib/errors.php:95
  log_warn("Failed to get a recordset: mysqli error: [1452: Ca...") at /var/www/mahara/master/htdocs/lib/errors.php:859
  SQLException->__construct("Failed to get a recordset: mysqli error: [1452: Ca...") at /var/www/mahara/master/htdocs/lib/dml.php:1105
  insert_record("view_rows_columns", object(stdClass), false, false) at /var/www/mahara/master/htdocs/lib/dml.php:1192
  ensure_record_exists("view_rows_columns", object(stdClass), object(stdClass)) at /var/www/mahara/master/htdocs/lib/view.php:356
  View->__construct(0array(size 25)) at /var/www/mahara/master/htdocs/lib/view.php:5581
  View::get_extra_view_info(array(size 2), false) at /var/www/mahara/master/htdocs/view/groupviews.php:52

  This happens if the group views and collections are readonly to
  members, a group collection exisits with at least one view inside and
  in the DB there is no view which has the same id as this collection.

  I didn't went too deep inside the code, but it seems that this issue
  is somehow connected to the bug #1514608.

  It further seems that Mahara interprets a collection as a view trying
  to get/set view related data using a collection id to avoid having no
  DB entry in table view_rows_columns for this erroneously supposed view
  so the actually error should be found in functions calling this code
  areas (get_extra_view_info).

  Reproduce error:
  Create a group in which views and collections are only editable by others that normal group members.
  Create a view and a collection inside this group and assign the view to the collection.
  Make sure, that in the DB there are no entries referring to a view which has the same id as the above created collection (e. g. by deleting a possibly existing view with this id inside Mahara).
  As a normal group member call the tab views and collection of the group.

  Greetings
  Alex

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1749402/+subscriptions


References