XMLWordPrintable

Details

    • Sub-task
    • Resolution: Won't Fix
    • Minor
    • None
    • 2.2.2
    • Local: Code checker
    • None
    • Hide

      Workaround is the following code:

      // Optional OU references support
      if (@include_once($CFG->dirroot . '/local/references/oucontent_assets.php')) {
          $donothing = true;
      }

      Show
      Workaround is the following code: // Optional OU references support if (@include_once($CFG->dirroot . '/local/references/oucontent_assets.php')) { $donothing = true; }
    • MOODLE_22_STABLE

    Description

      If you do this code:

      // Optional OU references support
      @include_once($CFG->dirroot- .- '/local/references/oucontent_assets.php');

      you get an error:

      819: File is being unconditionally included; use "require_once" instead

      In this case I am specifically including the file conditionally - in other words, I am happy for the file not to exist, that is why I am doing include_once instead of require_once. If the code doesn't exist, I don't want an error.

      I see what the test is for but I think there should be an exception if you use the @ symbol (which is necessary in this case, otherwise you get a warning when it doesn't exist) which indicates that you have considered that it might not exist. In other words if you do include_once you should still get this error but if you do @include_once this should be allowed.

      Attachments

        Activity

          People

            stronk7 Eloy Lafuente (stronk7)
            quen Sam Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Clockify

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