From 2ff7800ae8874153d3f2d5a8616a7c13377c10e9 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Wed, 29 Feb 2012 07:58:11 +0100 Subject: [PATCH] MDL-31807 fix invalid nulls in cohort components Credit goes to Stephen. --- cohort/lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cohort/lib.php b/cohort/lib.php index 9a084eb63b720..7b398f3540473 100644 --- a/cohort/lib.php +++ b/cohort/lib.php @@ -71,8 +71,9 @@ function cohort_add_cohort($cohort) { */ function cohort_update_cohort($cohort) { global $DB; - if (isset($cohort->component) and empty($cohort->component)) { - $cohort->component = NULL; + if (property_exists($cohort, 'component') and empty($cohort->component)) { + // prevent NULLs + $cohort->component = ''; } $cohort->timemodified = time(); $DB->update_record('cohort', $cohort);