Forums | Mahara Community

Support /
get_class() expects parameter 1 to be object, int given


Ma's profile picture
Posts: 14

23 June 2022, 0:17

Hello,

we are preparing to upgrade our Mahara site and are testing version 22.04.2 right now. We are seeing errors but are not sure if this is a bug or a problem with our site.

I create a new group and on the group homepage I click 'edit'. I add a new block of content type 'image' to the top, upload an image to 'group files', select it and click save. I then resize the image by dragging its corner to make it wider and higher. After that the logfile shows following errors (They are also shown on the page directly, if the site is not in production mode and debug messages are show; sometimes a page reload is neeeded it seems):

 

[WAR] f1 (lib/view.php:3841) get_class() expects parameter 1 to be object, int given


Call stack (most recent first):
log_message("get_class() expects parameter 1 to be object, int ...", 8, true, true, "/var/www/html/mahara.abc.xyz/lib/v...", 3841) at /var/www/html/mahara.abc.xyz/lib/errors.php:515
error(2, "get_class() expects parameter 1 to be object, int ...", "/var/www/html/mahara.abc.xyz/lib/v...", 3841, array(size 19)) at /var/www/html/mahara.abc.xyz/lib/view.php:3841
View::get_artefactchooser_artefacts(array(size 2), null, 603, null, true) at /var/www/html/mahara.abc.xyz/blocktype/lib.php:2336
BlockInstance->rebuild_artefact_list() at /var/www/html/mahara.abc.xyz/blocktype/lib.php:2275
BlockInstance->commit() at /var/www/html/mahara.abc.xyz/lib/view.php:2829
View->moveblockinstance(array(size 7)) at /var/www/html/mahara.abc.xyz/lib/view.php:2107
View->process_changes() at /var/www/html/mahara.abc.xyz/view/blocks.json.php:30


[WAR] f1 (lib/errors.php:853) Failed to get a recordset: mysqli error: [0: ] in EXECUTE("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 (
                SELECT
                    r.artefact, r.can_view, r.can_edit, m.group
                FROM
                    "group_member" m
                    JOIN "artefact" aa ON aa.group = m.group
                    JOIN "artefact_access_role" r ON aa.id = r.artefact AND r.role = m.role
                WHERE
                    m.group = ?
                    AND m.member = ?
                    AND r.can_view = 1
            ) 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 (
                SELECT
                    r.artefact, r.can_view, r.can_edit, m.group
                FROM
                    "group_member" m
                    JOIN "artefact" aa ON aa.group = m.group
                    JOIN "artefact_access_role" r ON aa.id = r.artefact AND r.role = m.role
                WHERE
                    m.group = ?
                    AND m.member = ?
                    AND r.can_view = 1
            ) 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/html/mahara.abc.xyz/lib/errors.php:89
log_warn("Failed to get a recordset: mysqli error: [0: ] in ...") at /var/www/html/mahara.abc.xyz/lib/errors.php:853
SQLException->__construct("Failed to get a recordset: mysqli error: [0: ] in ...") at /var/www/html/mahara.abc.xyz/lib/dml.php:540
get_recordset_sql("SELECT DISTINCT agg.* FROM (SELECT a.id, a.id AS b...", array(size 1), null, null) at /var/www/html/mahara.abc.xyz/lib/dml.php:720
get_records_sql_assoc("SELECT DISTINCT agg.* FROM (SELECT a.id, a.id AS b...", array(size 1), null, null) at /var/www/html/mahara.abc.xyz/lib/view.php:3967
View::get_artefactchooser_artefacts(array(size 2), null, 603, null, true) at /var/www/html/mahara.abc.xyz/blocktype/lib.php:2336
BlockInstance->rebuild_artefact_list() at /var/www/html/mahara.abc.xyz/blocktype/lib.php:2275
BlockInstance->commit() at /var/www/html/mahara.abc.xyz/lib/view.php:2829
View->moveblockinstance(array(size 7)) at /var/www/html/mahara.abc.xyz/lib/view.php:2107
View->process_changes() at /var/www/html/mahara.abc.xyz/view/blocks.json.php:30

 

We are seeing this errors on existing groups too. Is this a general bug or is this just a problem of our site?

Cheers

Robert Lyon's profile picture
Posts: 773

27 June 2022, 10:47

Hello Ma,

It does seem like an error that needs fixing up

I've created a bug report and fix for it here https://reviews.mahara.org/c/mahara/+/12960

It looks as though (for reasons I've not worked out yet) your system sends the group ID as an integer rather than a string - so I adjusted the check for it to handle string and integer in the same way.

This should fix the problem you are having

Cheers

Robert

 

Ma's profile picture
Posts: 14

27 June 2022, 21:51

Hello Robert,

thank you for your answer and the quick fix. We are trying it out right now. It looks good so far!

Cheers

3 results