Skip to content

Commit

Permalink
MDL-46792 core_group: Check that $data->name is set before trimming
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Butler <[email protected]>
  • Loading branch information
tonyjbutler committed Aug 15, 2014
1 parent e1eb180 commit f84b9e6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions group/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ function groups_update_group($data, $editform = false, $editoroptions = false) {
$context = context_course::instance($data->courseid);

$data->timemodified = time();
$data->name = trim($data->name);
if (isset($data->name)) {
$data->name = trim($data->name);
}
if (isset($data->idnumber)) {
$data->idnumber = trim($data->idnumber);
if (($existing = groups_get_group_by_idnumber($data->courseid, $data->idnumber)) && $existing->id != $data->id) {
Expand Down Expand Up @@ -420,7 +422,9 @@ function groups_update_group($data, $editform = false, $editoroptions = false) {
function groups_update_grouping($data, $editoroptions=null) {
global $DB;
$data->timemodified = time();
$data->name = trim($data->name);
if (isset($data->name)) {
$data->name = trim($data->name);
}
if (isset($data->idnumber)) {
$data->idnumber = trim($data->idnumber);
if (($existing = groups_get_grouping_by_idnumber($data->courseid, $data->idnumber)) && $existing->id != $data->id) {
Expand Down

0 comments on commit f84b9e6

Please sign in to comment.