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

MySQL case insensitivity breaks get_directory_files

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Deferred
    • 2.2.3
    • None
    • Files API
    • None
    • MySQL 5.5

    Description

      If there are two directories with the same path but in different cases, get_directory_files will return files from both on MySQL. To replicate:

      • Create a folder resource
      • Add two directories with the same name but in different cases (e.g. "lab_data" and "Lab_Data")
      • Add a file to one of them
      • Browse to the other
      • You should see the file

      (I think this may also be the root cause of the issues described in http://moodle.org/mod/forum/discuss.php?d=173393 and reported in MDL-29225.)

      This is caused by the fact that MySQL does case-insensitive string comparisons by default (http://dev.mysql.com/doc/refman/5.1/en/case-sensitivity.html). There seem to be two possible fixes for it, neither of which look as if they'd be easy to implement:

      • Change the collation of the mdl_files table
      • Insert the keyword BINARY into the SQL before the SUBSTR clause

      Attachments

        Issue Links

          Activity

            People

              maherne Michael Aherne
              maherne Michael Aherne
              Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: