Moodle: getContent() fails with cryptic error when not able to find file

Description

get_file() function in Moodle can return a boolean or an object. We always assume it finds the file and thus it is an object. When it returns a boolean you get an error which is hard to interpret.

Make sure that when a file is not found, this is reported properly to the end-user, or an appropriate error is thrown in php.

Environment

None

Acceptance Criteria

  • Handle not finding(returning a boolean) file in getContent() of file_storage.php in Moodle.

  • Timeboxed to 4 hours for delivering good error messages

Status

Assignee

Thomas Marstrander

Reporter

Thomas Marstrander

Labels

None

Funding

None

Code reviewer

None

Released

None

Time tracking

4h

Fix versions

Sprint

None

Priority

Medium
Configure