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

Make the behat section of setup.php re-entrant safe

XMLWordPrintable

    • MOODLE_25_STABLE
    • MOODLE_25_STABLE
    • Hide

      Run, for example the @mod_lesson behat tests, and look to the php builtin server output.

      • Without the patch you will see the errors reported in the description (because of yui combo re-including part of setup.php).
      • With the patch applied, those errors aren't there anymore (and lesson tests continue passing).

      That's all.

      Show
      Run, for example the @mod_lesson behat tests, and look to the php builtin server output. Without the patch you will see the errors reported in the description (because of yui combo re-including part of setup.php). With the patch applied, those errors aren't there anymore (and lesson tests continue passing). That's all.

      This is a followup of MDL-39478... copying from there:

      Aha, just found a problem with your code in setup.php not being re-entrant (and "theme/yui_combo.php" requires all code in setup.php to be re-entrant).

      Error (in the :8000 web browser):

      [Tue May  7 18:19:23 2013] PHP Notice:  Constant BEHAT_SITE_RUNNING already defined in lib/setup.php on line 131
      [Tue May  7 18:19:23 2013] PHP Stack trace:
      [Tue May  7 18:19:23 2013] PHP   1. {main}() theme/yui_combo.php:0
      [Tue May  7 18:19:23 2013] PHP   2. require() theme/yui_combo.php:94
      [Tue May  7 18:19:23 2013] PHP   3. define() lib/setup.php:131
      

      So yui_combo.php includes setup.php again that will be run until the ABORT_AFTER_CONFIG_CANCEL point. And your behat setup code is before that ABORT_AFTER_CONFIG_CANCEL point.

      So, there are 2 solutions...

      • Or you move the behat code after the ABORT_AFTER_CONFIG_CANCEL point.
      • Or you make the behat code re-entrant, so the define is executed conditionally.

      I'm going to try the 2nd alternative...

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            David Monllaó David Monllaó
            Dan Poltawski Dan Poltawski
            Dan Poltawski Dan Poltawski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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