Accessing profile pictures report a nonrecoverable error on prefixed tables

Bug #1077013 reported by Ali Hastie
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Gregor Anželj

Bug Description

When accessing Mahara 1.6.1 Content >> Profile pictures it states 'A nonrecoverable error occured. This probably means you have encoutered a bug in the system'.

It also states'No images found' and when I try yo upload an image, page refreshed with no image uploaded and stating the nonrecoverable error and 'No images found'.

Found this within Apache error logs:

Call stack (most recent first):, referer: http://mahara.barony.ac.uk/artefact/file/profileicons.php

* get_recordset_sql("SELECT a.id, a.title, a.note, (u.profileicon = a.i...", array(size 1), "", "") at /data/httpdata/v-hosts/mahara.barony.ac.uk/htdocs/lib/dml.php:667, referer: http://mahara.barony.ac.uk/artefact/file/profileicons.php

* get_records_sql_array("SELECT a.id, a.title, a.note, (u.profileicon = a.i...", array(size 1)) at /data/httpdata/v-hosts/mahara.barony.ac.uk/htdocs/artefact/file/profileicons.json.php:41, referer: http://mahara.barony.ac.uk/artefact/file/profileicons.php

 , referer: http://mahara.barony.ac.uk/artefact/file/profileicons.php

Revision history for this message
Melissa Draper (melissa) wrote :

Hi Ali,

I can't reproduce this, so I'll need more information from you.

Are there other errors? That looks like an incomplete stacktrace, look for something that says "fatal".

Also, could you check the logs for the database?

Thanks,
Melissa.

Changed in mahara:
status: New → Incomplete
importance: Undecided → High
Revision history for this message
Gregor Anželj (gregor-anzelj) wrote :

The problem is when Mahara database uses prefix for the tables. If there is no prefix, there is no problem...

The SQL that causes the problems can be found in {mahararoot}/artefact/file/profileicons.json.php.
The problems are in lines 35 and 36 which are:

LEFT OUTER JOIN view_artefact va ON va.artefact = a.id
LEFT OUTER JOIN artefact_attachment aa ON aa.attachment = a.id

but should be (notice the curly brackets around table names!):

LEFT OUTER JOIN {view_artefact} va ON va.artefact = a.id
LEFT OUTER JOIN {artefact_attachment} aa ON aa.attachment = a.id

Revision history for this message
Ali Hastie (ahastie) wrote :

Excellent Gregor! That works for me and allows the students to upload profile images too.

Many thanks.

Melissa Draper (melissa)
Changed in mahara:
status: Incomplete → Confirmed
milestone: none → 1.6.2
Changed in mahara:
assignee: nobody → Gregor Anželj (gregor-anzelj)
description: updated
Melissa Draper (melissa)
summary: - Accessing profile pictures report a nonrecoverable eror
+ Accessing profile pictures report a nonrecoverable error on prefixed
+ tables
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/1844
Committed: http://gitorious.org/mahara/mahara/commit/bd68573803233c29bb5e2445d9aef15568b033a2
Submitter: Melissa Draper (<email address hidden>)
Branch: 1.6_STABLE

commit bd68573803233c29bb5e2445d9aef15568b033a2
Author: Gregor Anzelj <email address hidden>
Date: Tue Nov 13 12:55:00 2012 +0100

    Escape table names in profile image query (Bug #1077013)

    When not escaped, the adodb abstraction layer did not use the prefix

    Change-Id: Id44f520e2331be7f3e322f2084412d0b3545701c
    Signed-off-by: Gregor Anzelj <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/1838
Committed: http://gitorious.org/mahara/mahara/commit/63395f248d2086e1a64a4f037209d22f60786acb
Submitter: Melissa Draper (<email address hidden>)
Branch: master

commit 63395f248d2086e1a64a4f037209d22f60786acb
Author: Gregor Anzelj <email address hidden>
Date: Tue Nov 13 12:55:00 2012 +0100

    Escape table names in profile image query (Bug #1077013)

    When not escaped, the adodb abstraction layer did not use the prefix

    Change-Id: Id44f520e2331be7f3e322f2084412d0b3545701c
    Signed-off-by: Gregor Anzelj <email address hidden>

Son Nguyen (ngson2000)
Changed in mahara:
status: Confirmed → 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.