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

Cohort administration pages require, not require_once, /cohort/lib.php

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.4.5, 3.5.2
    • 3.1.11, 3.2.8, 3.3.5, 3.4.2, 3.5
    • Cohorts
    • MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MDL-61238-master
    • Hide
      1. Add an include to /cohort/lib.php at the end of /config.php, after the require_once /lib/setup.php:  

        require_once(_DIR_. '/cohort/lib.php');

      • Verify that, with the patch missing, the cohort administration page does not load, yielding a white page or a fatal error depending on your debugging configuration.
      • Verify that, with the patch is applied, the cohort administration page loads.
      Show
      Add an include to /cohort/lib.php at the end of /config.php, after the require_once /lib/setup.php:   require_once(_DIR_. '/cohort/lib.php' ); Verify that, with the patch missing, the cohort administration page does not load, yielding a white page or a fatal error depending on your debugging configuration. Verify that, with the patch is applied, the cohort administration page loads.

      We've recently encountered an issue where cohort administration pages (both index.php and edit.php) serve up fatal errors to our LTs. This is caused by /cohort/lib.php being included twice, causing redeclaration of the functions.

      Note that this issue cannot be encountered on a stock Moodle instance, but with a customisation that includes /cohort/lib.php somewhere after the /lib/setup.php include. This can be simulated by adding the following line to the very bottom of /config.php, after the include:

      require_once "{$CFG->dirroot}/cohort/lib.php";
      

      Although not relevant, as an example of why a developer might wish to include the cohort library during initialisation: we use cohort memberships to target different branding configuration at our users. To achieve this we have a component that replaces the theme_config object on moodle_page with a branded variant.

            lukecarrier Luke Carrier
            lukecarrier Luke Carrier
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

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