Potential issue with artefact chooser and getting group artefacts
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Mahara | ||||||
21.04 |
Fix Released
|
Medium
|
Unassigned | |||
21.10 |
Fix Released
|
Medium
|
Unassigned | |||
22.04 |
Fix Released
|
Medium
|
Unassigned | |||
22.10 |
Fix Released
|
Medium
|
Unassigned |
Bug Description
There is an issue with View::get_
We need to fix that up so a group ID passed in as integer is also handled other wise the error below can occur.
The was reported by a community member and the only way I could replicate it was doing the following.
Make this change:
diff --git a/htdocs/
index 1bb21f32af.
--- a/htdocs/
+++ b/htdocs/
@@ -2337,7 +2337,7 @@ class BlockInstance {
- $this->
+ (int)$this-
true
);
Then create a new group and on the group homepage click 'edit'.
Add a new block of content type 'image' to the page, upload an image to 'group files' tab, select it and click save.
Then resize the image by dragging its corner to make it wider and higher.
Reload page and see the error.
But as they got the error without altering the code it would be best to harden the View::get_
[WAR] f1 (lib/view.php:3841) get_class() expects parameter 1 to be object, int given
Call stack (most recent first):
log_message(
error(2, "get_class() expects parameter 1 to be object, int ...", "/var/www/
View::get_
BlockInstance-
BlockInstance-
View->moveblock
View->process_
[WAR] f1 (lib/errors.
LEFT OUTER JOIN (
) ga ON (ga.group = a.group AND a.id = ga.artefact) WHERE (a.institution = 'mahara' OR ga.can_view = 1 OR a.owner = ?) AND a.id = 291249) AS agg")Command was: SELECT DISTINCT agg.* FROM (SELECT a.id, a.id AS b FROM "artefact" a LEFT JOIN "tag" t ON t.resourcetype = 'artefact' AND a.id = t.resourceid
LEFT OUTER JOIN (
) ga ON (ga.group = a.group AND a.id = ga.artefact) WHERE (a.institution = 'mahara' OR ga.can_view = 1 OR a.owner = ?) AND a.id = 291249) AS agg and values was (0:1135)
Call stack (most recent first):
log_message("Failed to get a recordset: mysqli error: [0: ] in ...", 8, true, true) at /var/www/
log_warn("Failed to get a recordset: mysqli error: [0: ] in ...") at /var/www/
SQLException-
get_recordset_
get_records_
View::get_
BlockInstance-
BlockInstance-
View->moveblock
View->process_
Changed in mahara: | |
milestone: | none → 22.10.0 |
status: | New → In Progress |
importance: | Undecided → Medium |
Changed in mahara: | |
status: | In Progress → Fix Committed |
no longer affects: | mahara |
Patch for "main" branch: https:/ /reviews. mahara. org/c/mahara/ +/12960