Copying of group throws ADODB error

Bug #1626705 reported by Kristina Hoeppner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Son Nguyen

Bug Description

Mahara 16.10dev, upgraded site from Mahara 16.04

I upgraded my site from 16.04 and when attempting to copy a group, it throws the following error:

[WAR] d3 (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, "/home/kristina/code/1610stable/htdocs/lib/adodb/ad...", 45) at /home/kristina/code/1610stable/htdocs/lib/errors.php:513
    error(8, "Array to string conversion", "/home/kristina/code/1610stable/htdocs/lib/adodb/ad...", 45, array(size 7)) at /home/kristina/code/1610stable/htdocs/lib/adodb/adodb-exceptions.inc.php:45
    ADODB_Exception->__construct("postgres8", "adodb_throw", -1, "ERROR: value too long for type character varying(...", "INSERT INTO "group" ("id", "name", "description", ...", array(size 28), object(ADODB_postgres8)) at /home/kristina/code/1610stable/htdocs/lib/adodb/adodb-exceptions.inc.php:80
    adodb_throw("postgres8", "adodb_throw", -1, "ERROR: value too long for type character varying(...", "INSERT INTO "group" ("id", "name", "description", ...", array(size 28), object(ADODB_postgres8)) at /home/kristina/code/1610stable/htdocs/lib/adodb/adodb.inc.php:298
    ADODB_TransMonitor("postgres8", "EXECUTE", -1, "ERROR: value too long for type character varying(...", "INSERT INTO "group" ("id", "name", "description", ...", array(size 28), object(ADODB_postgres8)) at /home/kristina/code/1610stable/htdocs/lib/adodb/adodb.inc.php:1249
    ADOConnection->_Execute("INSERT INTO "group" ("id", "name", "description", ...", array(size 28)) at /home/kristina/code/1610stable/htdocs/lib/adodb/adodb.inc.php:1209
    ADOConnection->Execute("INSERT INTO "group" ("id", "name", "description", ...", array(size 28)) at /home/kristina/code/1610stable/htdocs/lib/dml.php:1085
    insert_record("group", object(stdClass), "id", true) at /home/kristina/code/1610stable/htdocs/lib/group.php:451
    group_create(array(size 31)) at /home/kristina/code/1610stable/htdocs/lib/group.php:2808
    group_copy(2, "adminlist") at /home/kristina/code/1610stable/htdocs/group/copy.php:37

[WAR] d3 (lib/errors.php:819) Failed to get a recordset: postgres8 error: [-1: ERROR: value too long for type character varying(30)] in adodb_throw(INSERT INTO "group" ("id", "name", "description", "grouptype", "jointype", "ctime", "mtime", "public", "usersautoadded", "category", "viewnotify", "quota", "institution", "shortname", "request", "submittableto", "editroles", "hidden", "hidemembers", "hidemembersfrommembers", "groupparticipationreports", "invitefriends", "suggestfriends", "urlid", "editwindowend", "sendnow", "feedbacknotify", "allowarchives") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), Array)
Command was: INSERT INTO "group" ("id", "name", "description", "grouptype", "jointype", "ctime", "mtime", "public", "usersautoadded", "category", "viewnotify", "quota", "institution", "shortname", "request", "submittableto", "editroles", "hidden", "hidemembers", "hidemembersfrommembers", "groupparticipationreports", "invitefriends", "suggestfriends", "urlid", "editwindowend", "sendnow", "feedbacknotify", "allowarchives") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and values was (id:10,name:HumanComputerInteraction101v.2,description:<p>Foundationcourseforbeginners</p>,grouptype:course,jointype:approve,ctime:2016-09-2307:15:43,mtime:2016-09-2307:15:43,public:0,usersautoadded:0,category:1,viewnotify:1,quota:52428800,institution:mahara,shortname:humancomputerinteraction101a,request:1,submittableto:1,editroles:notmember,hidden:0,hidemembers:0,hidemembersfrommembers:0,groupparticipationreports:0,invitefriends:1,suggestfriends:0,urlid:human-computer-interaction-101-v-2,editwindowend:2016-11-0700:00:00,sendnow:0,feedbacknotify:1,allowarchives:0)
Call stack (most recent first):

    log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /home/kristina/code/1610stable/htdocs/lib/errors.php:95
    log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /home/kristina/code/1610stable/htdocs/lib/errors.php:819
    SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /home/kristina/code/1610stable/htdocs/lib/dml.php:1088
    insert_record("group", object(stdClass), "id", true) at /home/kristina/code/1610stable/htdocs/lib/group.php:451
    group_create(array(size 31)) at /home/kristina/code/1610stable/htdocs/lib/group.php:2808
    group_copy(2, "adminlist") at /home/kristina/code/1610stable/htdocs/group/copy.php:37

[WAR] d3 (lib/dml.php:1088) Failed to get a recordset: postgres8 error: [-1: ERROR: value too long for type character varying(30)] in adodb_throw(INSERT INTO "group" ("id", "name", "description", "grouptype", "jointype", "ctime", "mtime", "public", "usersautoadded", "category", "viewnotify", "quota", "institution", "shortname", "request", "submittableto", "editroles", "hidden", "hidemembers", "hidemembersfrommembers", "groupparticipationreports", "invitefriends", "suggestfriends", "urlid", "editwindowend", "sendnow", "feedbacknotify", "allowarchives") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), Array)
Command was: INSERT INTO "group" ("id", "name", "description", "grouptype", "jointype", "ctime", "mtime", "public", "usersautoadded", "category", "viewnotify", "quota", "institution", "shortname", "request", "submittableto", "editroles", "hidden", "hidemembers", "hidemembersfrommembers", "groupparticipationreports", "invitefriends", "suggestfriends", "urlid", "editwindowend", "sendnow", "feedbacknotify", "allowarchives") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and values was (id:10,name:HumanComputerInteraction101v.2,description:<p>Foundationcourseforbeginners</p>,grouptype:course,jointype:approve,ctime:2016-09-2307:15:43,mtime:2016-09-2307:15:43,public:0,usersautoadded:0,category:1,viewnotify:1,quota:52428800,institution:mahara,shortname:humancomputerinteraction101a,request:1,submittableto:1,editroles:notmember,hidden:0,hidemembers:0,hidemembersfrommembers:0,groupparticipationreports:0,invitefriends:1,suggestfriends:0,urlid:human-computer-interaction-101-v-2,editwindowend:2016-11-0700:00:00,sendnow:0,feedbacknotify:1,allowarchives:0)
Call stack (most recent first):

    insert_record("group", object(stdClass), "id", true) at /home/kristina/code/1610stable/htdocs/lib/group.php:451
    group_create(array(size 31)) at /home/kristina/code/1610stable/htdocs/lib/group.php:2808
    group_copy(2, "adminlist") at /home/kristina/code/1610stable/htdocs/group/copy.php:37

Son Nguyen (ngson2000)
Changed in mahara:
assignee: nobody → Son Nguyen (ngson2000)
status: Confirmed → In Progress
Revision history for this message
Son Nguyen (ngson2000) wrote :

The problem is the value of group urlid is longer than 30.
This value is generated by the function generate_urlid()
at line 2799, htdocs/lib/group.php

 $group->urlid = generate_urlid($group->name, get_config('cleanurlviewdefault'), 3, 100);

The max length should set to 30

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/7007

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/7007
Committed: https://git.mahara.org/mahara/mahara/commit/a8de4df8b7d0fe23fde0b7963d0107093c12a101
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit a8de4df8b7d0fe23fde0b7963d0107093c12a101
Author: Son Nguyen <email address hidden>
Date: Fri Sep 23 10:37:15 2016 +1200

Bug 1626705: Limit the length of group urlid to 30 when generating

behatnotneeded

Change-Id: I9f624b8bbc0ab7c53ebc84f5f8110ae257c6949e

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "16.10_STABLE" branch: https://reviews.mahara.org/7094

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/7094
Committed: https://git.mahara.org/mahara/mahara/commit/7f62ff6970e384a175dedff4b86b9955ad4521a2
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.10_STABLE

commit 7f62ff6970e384a175dedff4b86b9955ad4521a2
Author: Son Nguyen <email address hidden>
Date: Fri Sep 23 10:37:15 2016 +1200

Bug 1626705: Limit the length of group urlid to 30 when generating

behatnotneeded

Change-Id: I9f624b8bbc0ab7c53ebc84f5f8110ae257c6949e
(cherry picked from commit a8de4df8b7d0fe23fde0b7963d0107093c12a101)

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.