"Undefined index" warning on account settings page

Bug #1311963 reported by Aaron Wells on 2014-04-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Unassigned

Bug Description

In Mahara 1.10dev, when I go to the account settings page for a user who belongs to an institution, I see this warning at the top of the page:

[WAR] b0 (admin/users/edit.php:661) Undefined index: one
Call stack (most recent first):

    log_message("Undefined index: one", 8, true, true, "/home/aaronw/www/mahara/htdocs/admin/users/edit.ph...", 661) at /home/aaronw/www/mahara/htdocs/lib/errors.php:433
    error(8, "Undefined index: one", "/home/aaronw/www/mahara/htdocs/admin/users/edit.ph...", 661, array(size 73)) at /home/aaronw/www/mahara/htdocs/admin/users/edit.php:661

This is because we added an "id" column to the institution table, and there is a call to get_records_assoc() that uses the default '*' for the fields to use. Later code then assumes that the key of the returned array will be institution.name, when in fact it is now institution.id.

Note that this can only be replicated on a clean install of 1.10. If you upgrade to 1.10, then the "name" column will still be first.

Reviewed: https://reviews.mahara.org/3287
Committed: http://gitorious.org/mahara/mahara/commit/f91fbf0aa2bcf08876c1ad8646b298c92b3d79dd
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit f91fbf0aa2bcf08876c1ad8646b298c92b3d79dd
Author: Aaron Wells <email address hidden>
Date: Thu Apr 24 14:49:31 2014 +1200

Fixes an "undefined index" warning on the account settings page

Bug 1311963. The call to get_records_assoc() assumes that institution.name
will be the first column returned. But we've added an institution.id column
that comes before that, so now we need to specifically tell it to use the
name column instead.

Change-Id: I51ef6e805b80894fa6af7bc732fb241adac0fdec

Robert Lyon (robertl-9) on 2014-04-28
Changed in mahara:
status: In Progress → Fix Committed
Aaron Wells (u-aaronw) on 2014-10-21
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