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

Unit tests should complain when library code calls set_time_limit

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.5
    • 2.5
    • Unit tests
    • None

      Callign set_time_limit or changing max_execution_time in library code is dangerous.

      Suppose some part of cron calls a function that does that. (Cron normally runs form the command line with no time limit.) Then, randomly, some later part of cron may time out. That is bad.

      (Of course, there are some parts of Moodle, like backup and restore, which do legitimately need to call set_time_limit, but they should be the exception, and the set_time_limit calls should be in the UI layer.)

      Anyway, because of this danger, the unit tests should complain if they detect that the max_execution_time has changed. (At the moment they just set it back to 0. See MDL-38912.) But before we can do that, we need to fix the places (currently three) where warning about this causes the unit tests to fail.

      The necessary code to display the warning is in lib/phpunit/classes/util.php, but commented out. Just search for this issue number.

            skodak Petr Skoda
            timhunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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