Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.1.2
-
Component/s: Gradebook
-
Testing Instructions:
-
Affected Branches:MOODLE_21_STABLE
-
Fixed Branches:MOODLE_21_STABLE, MOODLE_22_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-30880_feedback_property -
Pull Master Diff URL:
Description
Editing a grade for a non-core module in the gradebook, checking locked and then un-checking locked produces a PHP notice and prevents the page from redirecting automatically.
Reproduction steps:
- Log in as an admin/instructor
- Go into the course and click Grades
- Turn on editing
- Edit the grade for the non-core plug-in
- Check 'locked' and save
- Go back and edit that same grade
- Un-check 'locked' click save
- The page displays the following message
Notice: Undefined property: stdClass::$feedback in /var/www/html/ack/testsite/grade/edit/tree/grade.php on line 165 Call Stack: 0.0019 779336 1.
Unknown macro: {main}() /var/www/html/ack/testsite/grade/edit/tree/grade.php:0
Skip to main contentThis page should automatically redirect. If nothing is happening please use the continue link below.
(Continue)Error output, so disabling automatic redirect.
Here is the line of code that produces that notice message
if (is_array($data->feedback)) {
|
$data->feedbackformat = $data->feedback['format'];
|
$data->feedback = $data->feedback['text'];
|
}
|
The code should first check to see if the feedback property exists and then check to see if it is an array
if (isset($data->feedback) && is_array($data->feedback)) {
|
$data->feedbackformat = $data->feedback['format'];
|
$data->feedback = $data->feedback['text'];
|
}
|
The same thing happens when editing core graded modules but for some reason the notice message does not appear.