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

Plugin's lib.php loaded prematurely during plugins installation

    XMLWordPrintable

Details

    • Bug
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 3.3.2
    • None
    • None
    • MOODLE_33_STABLE
    • Hide

      Fix test

      1. Follow the steps to reproduce and assert seeing the expected behaviour (hint: this was discovered while attempting to install local_yumymedia without local_yukaltura)

      Regression test

      1. Repeat the test from MDL-53978
      Show
      Fix test Follow the steps to reproduce and assert seeing the expected behaviour (hint: this was discovered while attempting to install local_yumymedia without local_yukaltura) Regression test Repeat the test from MDL-53978

    Description

      I have a suspicion that MDL-53978 caused a regression. Those calls like

      get_plugins_with_function('before_http_headers', 'lib.php');
      

      are also made during plugin installation (when rendering the plugin checks screen) and they cause lib.php files be loaded from all plugins - even if the plugin may have an unsatisfied dependency.

      Reproduce:
      1. Have a plugin B that correctly declares dependency on a plugin A. In the B's lib.php, require_once() some A's file.
      2. Unzip the code of the plugin B into Moodle and run installation by visiting the admin main screen

      Expected:
      The missing dependency A should be reported, giving the admin the opportunity to provide it

      Actual:
      PHP fatal error thrown because B's lib.php has been loaded prematurely to check for the presence of the new callbacks.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mudrd8mz David Mudrák (@mudrd8mz)
              Andrew Lyons Andrew Lyons
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: