Skip to content

Missing pass-by-reference in restore loop causes statusset mapping to be lost #898

@Fragonite

Description

@Fragonite

The $statusset array is looped over to update the status IDs using $this->get_mappingid(). However, because the loop variable $st is assigned by value instead of by reference, the newly mapped IDs are discarded and the old IDs from the backup file end up being saved to the database.

A quick fix would be to add an & to pass by reference (or just update the value via the array key):

https://github.com/danmarsden/moodle-mod_attendance/blob/MOODLE_501_STABLE/backup/moodle2/restore_attendance_stepslib.php#L183

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions