Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-65104

core\hub\registration does not play type tetris properly

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Important: These steps need to be run on a fresh install.

      1. Before installing moodle; place the attached local plugin in the appropriate directory
      2. Install moodle
      3. From the root of your moodle install run "php local/hubtest/queuetasks.php"
      4. From the root of your moodle install run "php admin/cli/cron.php"
      5. Look through the output of the cron run and ensure you see:

      \core\hub\registration::get_registration(false) : (object) array(
         'id' => '1',
         'token' => 'somejunkhere',
         'hubname' => 'The Movie Chef',
         'huburl' => 'https://moodle.net',
         'confirmed' => '0',
         'secret' => 'somemorejunk',
         'timemodified' => '1553158418',
      )
      

      Show
      Important: These steps need to be run on a fresh install. Before installing moodle; place the attached local plugin in the appropriate directory Install moodle From the root of your moodle install run " php local/hubtest/queuetasks.php " From the root of your moodle install run " php admin/cli/cron.php " Look through the output of the cron run and ensure you see: \core\hub\registration::get_registration(false) : (object) array( 'id' => '1', 'token' => 'somejunkhere', 'hubname' => 'The Movie Chef', 'huburl' => 'https://moodle.net', 'confirmed' => '0', 'secret' => 'somemorejunk', 'timemodified' => '1553158418', )
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull 3.5 Branch:
    • Pull 3.6 Branch:
    • Pull Master Branch:
      MDL-65104-master

      Description

      core\hub\registration initialises the static variable $registration to null, and we make an === check to see if it is null in get_registration

      However, straight after that, we have:

      self::$registration = $DB->get_record('registration_hubs', ['huburl' => HUB_MOODLEORGHUBURL]);

      The issue is that the DML can return false, and the triple equality check can fail on subsequent calls to require_registration

      This bit us on cloud, where we have our own adhoc task to manage registrations; which runs after core's registration_cron_task. Core's task caused $registration to be set to false, and then when we tried to retrieve the registration in our own task, it was not loaded from the DB (as the === test failed).

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/May/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 40 minutes
                1h 40m