Multiple journal error with image in description field

Bug #1474143 reported by Robert Lyon on 2015-07-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Robert Lyon
15.04
Medium
Robert Lyon
15.10
Undecided
Unassigned

Bug Description

There seems to be a problem with adding a new journal to a user on master:

To test:

1) Go to user's settings and allow multiple journals
2) Go to Content -> Journals and add new journal
3) Give it a title and in the description field add some text and embedded image
4) Click 'Create journal'

You will get the following error:

[WAR] 90 (lib/adodb/adodb-exceptions.inc.php:43) Array to string conversion
Call stack (most recent first):

    log_message("Array to string conversion", 8, true, true, "/home/robertl/htdocs/mahara-devel/mahara/htdocs/li...", 43) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/errors.php:441
    error(8, "Array to string conversion", "/home/robertl/htdocs/mahara-devel/mahara/htdocs/li...", 43, array(size 7)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/adodb/adodb-exceptions.inc.php:43
    ADODB_Exception->__construct("postgres8", "adodb_throw", -1, "ERROR: null value in column "locked" violates not...", "UPDATE "artefact" SET "artefacttype" = ? , "contai...", array(size 22), object(ADODB_postgres8)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/adodb/adodb-exceptions.inc.php:78
    adodb_throw("postgres8", "adodb_throw", -1, "ERROR: null value in column "locked" violates not...", "UPDATE "artefact" SET "artefacttype" = ? , "contai...", array(size 22), object(ADODB_postgres8)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/adodb/adodb.inc.php:259
    ADODB_TransMonitor("postgres8", "EXECUTE", -1, "ERROR: null value in column "locked" violates not...", "UPDATE "artefact" SET "artefacttype" = ? , "contai...", array(size 22), object(ADODB_postgres8)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/adodb/adodb.inc.php:1071
    ADOConnection->_Execute("UPDATE "artefact" SET "artefacttype" = ? , "contai...", array(size 22)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/adodb/adodb.inc.php:1042
    ADOConnection->Execute("UPDATE "artefact" SET "artefacttype" = ? , "contai...", array(size 22)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/dml.php:1264
    update_record("artefact", object(stdClass), "id") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/lib.php:626
    ArtefactType->commit() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/lib.php:159
    ArtefactTypeBlog->commit() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/lib.php:579
    ArtefactType->__destruct() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:83
    ArtefactTypeBlog::new_blog(object(LiveUser), array(size 5)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:83
    newblog_submit(object(Pieform), array(size 5)) at Unknown:0
    call_user_func_array("newblog_submit", array(size 2)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:537
    Pieform->__construct(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:164
    Pieform::process(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:67

[WAR] 90 (lib/errors.php:747) Failed to get a recordset: postgres8 error: [-1: ERROR: null value in column "locked" violates not-null constraint] in adodb_throw(UPDATE "artefact" SET "artefacttype" = ? , "container" = ? , "parent" = ? , "owner" = ? , "institution" = ? , "group" = ? , "ctime" = ? , "mtime" = ? , "atime" = ? , "locked" = ? , "title" = ? , "description" = ? , "note" = ? , "author" = ? , "authorname" = ? , "allowcomments" = ? , "approvecomments" = ? , "license" = ? , "licensor" = ? , "licensorurl" = ? , "path" = ? WHERE "id" = ? , Array)
Command was: UPDATE "artefact" SET "artefacttype" = ? , "container" = ? , "parent" = ? , "owner" = ? , "institution" = ? , "group" = ? , "ctime" = ? , "mtime" = ? , "atime" = ? , "locked" = ? , "title" = ? , "description" = ? , "note" = ? , "author" = ? , "authorname" = ? , "allowcomments" = ? , "approvecomments" = ? , "license" = ? , "licensor" = ? , "licensorurl" = ? , "path" = ? WHERE "id" = ? and values was (blog,1,,1,,,2015-07-14 09:44:20,2015-07-14 09:44:20,2015-07-14 09:44:20,,Dogs,<p>woof woof <img width="368" height="100" style="" src="http://mahara-devel/artefact/file/download.php?file=24031&embedded=1&blog=24032"></p>
,,1,,,,,,,/24032,24032)
Call stack (most recent first):

    log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/errors.php:97
    log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/errors.php:747
    SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/dml.php:1268
    update_record("artefact", object(stdClass), "id") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/lib.php:626
    ArtefactType->commit() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/lib.php:159
    ArtefactTypeBlog->commit() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/lib.php:579
    ArtefactType->__destruct() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:83
    ArtefactTypeBlog::new_blog(object(LiveUser), array(size 5)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:83
    newblog_submit(object(Pieform), array(size 5)) at Unknown:0
    call_user_func_array("newblog_submit", array(size 2)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:537
    Pieform->__construct(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:164
    Pieform::process(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:67

[WAR] 90 (lib/dml.php:1268) Failed to get a recordset: postgres8 error: [-1: ERROR: null value in column "locked" violates not-null constraint] in adodb_throw(UPDATE "artefact" SET "artefacttype" = ? , "container" = ? , "parent" = ? , "owner" = ? , "institution" = ? , "group" = ? , "ctime" = ? , "mtime" = ? , "atime" = ? , "locked" = ? , "title" = ? , "description" = ? , "note" = ? , "author" = ? , "authorname" = ? , "allowcomments" = ? , "approvecomments" = ? , "license" = ? , "licensor" = ? , "licensorurl" = ? , "path" = ? WHERE "id" = ? , Array)
Command was: UPDATE "artefact" SET "artefacttype" = ? , "container" = ? , "parent" = ? , "owner" = ? , "institution" = ? , "group" = ? , "ctime" = ? , "mtime" = ? , "atime" = ? , "locked" = ? , "title" = ? , "description" = ? , "note" = ? , "author" = ? , "authorname" = ? , "allowcomments" = ? , "approvecomments" = ? , "license" = ? , "licensor" = ? , "licensorurl" = ? , "path" = ? WHERE "id" = ? and values was (blog,1,,1,,,2015-07-14 09:44:20,2015-07-14 09:44:20,2015-07-14 09:44:20,,Dogs,<p>woof woof <img width="368" height="100" style="" src="http://mahara-devel/artefact/file/download.php?file=24031&embedded=1&blog=24032"></p>
,,1,,,,,,,/24032,24032)
Call stack (most recent first):

    update_record("artefact", object(stdClass), "id") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/lib.php:626
    ArtefactType->commit() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/lib.php:159
    ArtefactTypeBlog->commit() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/lib.php:579
    ArtefactType->__destruct() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:83
    ArtefactTypeBlog::new_blog(object(LiveUser), array(size 5)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:83
    newblog_submit(object(Pieform), array(size 5)) at Unknown:0
    call_user_func_array("newblog_submit", array(size 2)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:537
    Pieform->__construct(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:164
    Pieform::process(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 6)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:67

Robert Lyon (robertl-9) wrote :

This seems to be caused by the bit:

    ArtefactTypeBlog->commit() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/lib.php:579
    ArtefactType->__destruct() at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:83
    ArtefactTypeBlog::new_blog(object(LiveUser), array(size 5)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/artefact/blog/new/index.php:83

Where a new blog is going to be created but ArtefactType->__destruct() is called first so that the new blog is not an insert by an update sql call, which in turn fails because column 'locked' doesn't have any value.

Robert Lyon (robertl-9) on 2015-07-13
Changed in mahara:
status: Confirmed → In Progress
tags: added: regression

Reviewed: https://reviews.mahara.org/4955
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/b73847f766cab1ef0700b79ca5f2344bf7b877de
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit b73847f766cab1ef0700b79ca5f2344bf7b877de
Author: Robert Lyon <email address hidden>
Date: Tue Jul 14 10:14:11 2015 +1200

Bug 1474143: Allowing artefacts to be created with their sql defaults

This fixes the create new blog with embedded image problem

Change-Id: I4ee50c267a689aa92e841ca508a818ed1d22d814
Signed-off-by: Robert Lyon <email address hidden>

Changed in mahara:
status: In Progress → Fix Committed

Reviewed: https://reviews.mahara.org/5118
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/dbce1c2f761646fc7aed706b630d5ad8231595bd
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit dbce1c2f761646fc7aed706b630d5ad8231595bd
Author: Robert Lyon <email address hidden>
Date: Tue Jul 14 10:14:11 2015 +1200

Bug 1474143: Allowing artefacts to be created with their sql defaults

This fixes the create new blog with embedded image problem

Change-Id: I4ee50c267a689aa92e841ca508a818ed1d22d814
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit b73847f766cab1ef0700b79ca5f2344bf7b877de)

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

Other bug subscribers