Calendar page error after upgrading from 3.0.1 > 3.1 > 3.5

Calendar page error after upgrading from 3.0.1 > 3.1 > 3.5

by John McCarthy -
Number of replies: 0

Hi,

After a successful migration from 3.0.1 > 3.1 then to 3.5, I have one issue.

Upon visiting http://site.com/calendar/view.php?view=month&course. I have the following error.


Can not find data record in database table course. More information about this error Debug info: SELECT * FROM {course} WHERE id = ? [array ( 0 => 0, )] Error code: invalidrecord Stack trace: line 1546 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown line 1522 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select() line 588 of /lib/datalib.php: call to moodle_database->get_record() line 85 of /calendar/view.php: call to get_course()


I've checked through the stack on the 3.0.1 version and the 3.5 version as I have both running (The migration is being tested on a staging setup).

It appears that in both, it's calling for a course of ID 0. Which doesn't exist. In 3.0.1 there's no error generated in the file but no data is output on the calendar due to the missing course id. In 3.5 there is of course an error and this prevents the page from completing it's view.


It's the get_course($course_id)that fails due to a non existent ID. 


$course_id comes form the line 53. $courseid = optional_param('course', SITEID, PARAM_INT);


Printing these params I get SITEID = (string) 1, but when printing $course_id, I get (int) 0.


For now I've added a check to enable testing of the system as follows. 


if ( $courseid == 0 ) {

    $courseid = SITEID;

}


Why would the parameter go from 1 to 0 is it due to the site ID being a string?

Average of ratings: -