MDL-65104 registration: Ensure $registration is always null when no record exists MDL-65104-master
authorCameron Ball <cameron@moodle.com>
Thu, 21 Mar 2019 08:04:37 +0000 (16:04 +0800)
committerCameron Ball <cameron@moodle.com>
Thu, 21 Mar 2019 08:12:12 +0000 (16:12 +0800)
lib/classes/hub/registration.php

index 805434f..d123dbe 100644 (file)
@@ -82,7 +82,7 @@ class registration {
         global $DB;
 
         if (self::$registration === null) {
-            self::$registration = $DB->get_record('registration_hubs', ['huburl' => HUB_MOODLEORGHUBURL]);
+            self::$registration = $DB->get_record('registration_hubs', ['huburl' => HUB_MOODLEORGHUBURL]) ?: null;
         }
 
         if (self::$registration && (bool)self::$registration->confirmed == (bool)$confirmed) {
@@ -581,4 +581,4 @@ class registration {
             redirect(new moodle_url('/admin/registration/index.php', ['returnurl' => $returnurl->out_as_local_url(false)]));
         }
     }
-}
\ No newline at end of file
+}