LMSouq
moodle-core Open

Url parameters values can not be arrays

JO
John Pantelidis
1 month ago
3 views
Problem Description
I am using <a href='https://moodle.org/'>Moodle</a> version 3.8.4+ and PHP version 7.2.33 . Today I noticed a strange issue when I was trying to send a message to students, the message was: > Coding error detected, it must be fixed by a programmer: Url parameters values can not be arrays! <a href='https://docs.moodle.org/38/en/error/debug/codingerror'>More information about this error</a> I purge all caches as the suggestion was on "more information" section but it did not work. I run the same Moodle version and PHP version on non production environment with the debugging mode and then I got this error message: > Coding error detected, it must be fixed by a programmer: Url parameters values can not be arrays! More information about this error Debug info: Error code: codingerror Stack trace: <br>        line 405 of /lib/weblib.php: coding_exception thrown <br>        line 460 of /lib/weblib.php: call to moodle_url->params() <br>        line 49 of /mod/reservation/messageselect.php: call to moodle_url->param() <br> Output buffer: <br>Invalid array parameter detected in required_param(): messagebody <br> line 655 of /lib/moodlelib.php: call to debugging() <br> line 30 of /mod/reservation/messageselect.php: call to optional_param() The messageselect.php file is this but I am not able to see any issues here: ```php require_once('../../config.php'); require_once($CFG->dirroot.'/message/lib.php'); $id = required_param('id', PARAM_INT); $messagebody = optional_param('messagebody', '', PARAM_CLEANHTML); $send = optional_param('send', '', PARAM_BOOL); $preview = optional_param('preview', '', PARAM_BOOL); $edit = optional_param('edit', '', PARAM_BOOL); $returnto = optional_param('returnto', new moodle_url('/mod/reservation/view.php', array('id' => $id)), PARAM_LOCALURL); $format = optional_param('format', FORMAT_MOODLE, PARAM_INT); $deluser = optional_param('deluser', 0, PARAM_INT); if (isset($id)) { if (! $cm = get_coursemodule_from_id('reservation', $id)) { error('Course Module ID was incorrect'); } if (! $course = $DB->get_record('course', array('id' => $cm->course))) { error('Course is misconfigured'); } } $url = new moodle_url('/mod/reservation/messageselect.php', array('id' => $id)); if ($messagebody !== '') { $url->param('messagebody', $messagebody); } if ($send !== '') { $url->param('send', $send); } if ($preview !== '') { $url->param('preview', $preview); } if ($edit !== '') {...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base