Browse files

MDL-31807 fix invalid nulls in cohort components

Credit goes to Stephen.
  • Loading branch information...
1 parent e356fb6 commit 0908a1a327b67ee6b3a3e4fb303b24cbb4a61128 @skodak skodak committed Feb 29, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 cohort/lib.php
View
5 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);

0 comments on commit 0908a1a

Please sign in to comment.