Fatal error upgrading from 1.4 or earlier to 1.10 or later, with objectionable content reports

Bug #1494152 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Invalid
Medium
Aaron Wells
1.10
Fix Released
Medium
Aaron Wells
15.04
Fix Released
Medium
Aaron Wells
15.10
Invalid
Medium
Aaron Wells

Bug Description

In Mahara 1.10, when we added objectionable item reporting to the forums, we migrated all the old objectionable item view_access records into the new "objectionable" table. Part of this upgrade took view_access.ctime and used it for the "reportdate" column in the objectionable table, because view_access.ctime is supposed to be not null.

But, if you upgraded from Mahara 1.4 or earlier, view_access.ctime is NULL (see https://bugs.launchpad.net/bugs/1494128 ). So, this causes the upgrade to crash.

To replicate:

1. Install Mahara 1.4
2. Create a page
3. Go to the page and use the "Report objectionable" button on it.
4. Upgrade to Mahara 1.10

Expected result: Successful upgrade
Actual result: Fatal error.

[WAR] bb (lib/dml.php:1046) Failed to get a recordset: postgres7 error: [-1: ERROR: null value in column "reportedtime" violates not-null constraint] in adodb_throw(INSERT INTO "objectionable" ("objecttype", "objectid", "reportedby", "report") VALUES (?, ?, ?, ?), Array)
[WAR] bb (lib/dml.php:1046) Command was: INSERT INTO "objectionable" ("objecttype", "objectid", "reportedby", "report") VALUES (?, ?, ?, ?) and values was (view,6,0,)
Call stack (most recent first):
  * insert_record("objectionable", object(stdClass)) at /home/aaronw/www/mahara/htdocs/lib/db/upgrade.php:3383
  * xmldb_core_upgrade("2011061015") at /home/aaronw/www/mahara/htdocs/lib/upgrade.php:359
  * upgrade_core(object(stdClass)) at /home/aaronw/www/mahara/htdocs/lib/mahara.php:253
  * upgrade_mahara(array(size 14)) at /home/aaronw/www/mahara/htdocs/admin/cli/upgrade.php:50

A nonrecoverable error occurred. This probably means you have encountered a bug in the system(1.10_STABLE)aaronw@vega

Revision history for this message
Aaron Wells (u-aaronw) wrote :

It appears this was already fixed in 15.10 as part of one of the commits for Bug 1450680. But it wasn't backported to 15.04 and 1.10.

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

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/5254

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

Reviewed: https://reviews.mahara.org/5254
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/0a5978791d84b6618f19c173cd2d5f6bfd195104
Submitter: Son Nguyen (<email address hidden>)
Branch: 15.04_STABLE

commit 0a5978791d84b6618f19c173cd2d5f6bfd195104
Author: Aaron Wells <email address hidden>
Date: Thu Sep 10 19:16:14 2015 +1200

Fix crash during upgrade (Bug 1494152)

If you're upgrading from 1.4 or earlier, view_access.ctime
is sometimes NULL.

behatnotneeded: Covered by existing tests

Change-Id: I33ef7f80a3a0c4dde2787fc1ad4d3c05e60ba8eb

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

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/5625

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

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

commit ea8ae38bf2822ab702578dd8f8df51e07e8596c2
Author: Aaron Wells <email address hidden>
Date: Thu Sep 10 19:16:14 2015 +1200

Fix crash during upgrade (Bug 1494152)

If you're upgrading from 1.4 or earlier, view_access.ctime
is sometimes NULL.

behatnotneeded: Covered by existing tests

Change-Id: I33ef7f80a3a0c4dde2787fc1ad4d3c05e60ba8eb
(cherry picked from commit 0a5978791d84b6618f19c173cd2d5f6bfd195104)

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.