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

Repository get_instances silently uses the system context if you pass the wrong thing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.9.7, 3.10.4
    • 3.9.6, 3.10.3, 3.11, 4.0
    • Repositories
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • Hide

      Just run automated tests.

      (This is just improved debug output. The only thing to tests is that this does not cause regressions, and the automated tests are enough for that.)

      Show
      Just run automated tests. (This is just improved debug output. The only thing to tests is that this does not cause regressions, and the automated tests are enough for that.)

      Steps to reproduce:

      1. Accidentally write the code

      $repositories = repository::get_instances(['currentcontext' => $context->id]);
      

      Actual result: it seems to work, until some time later things mysteriously don't work and you have to spend a lot of time debugging it.

      Expected result (once you realise it is buggy): A debugging notice like "'currentcontext' passed to repository::get_instances was not a context object. Using system context instead, but you should probably fix your code."

            timhunt Tim Hunt
            timhunt Tim Hunt
            Sujith Haridasan Sujith Haridasan
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 26 minutes
                26m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.