Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-7873

Warn about uses of DIRECTORY_SEPARATOR

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Deferred
    • Affects Version/s: 3.6.6, 3.7
    • Fix Version/s: None
    • Component/s: Local: Code checker
    • Labels:
      None
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE

      Description

      Usually DIRECTORY_SEPARATOR is not needed at all.

      Only when PHP paths from conf/OS or comparisons with DIR are done we may need to normalize it to forward slashes .

      But all the handling within Moodle should be, exclusively, forward slashes. All OSs understand it. More specifically within Moodle APIs (file, caching...) it never should be used.

      https://dev.to/c33s/always-use--as-directory-seperator-in-php-43l7

      So a warning explaining the above whenever DIRECTORY_SEPARATOR uses are found... may be a good thing.

        Attachments

          Activity

            People

            Assignee:
            moodle.com moodle.com
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Participants:
            Component watchers:
            moodle.com, Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: