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

MySQL case insensitivity breaks get_directory_files

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Deferred
    • Affects Version/s: 2.2.3
    • Fix Version/s: None
    • Component/s: Files API
    • Labels:
      None
    • Environment:
      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

              Assignee:
              maherne Michael Aherne
              Reporter:
              maherne Michael Aherne
              Participants:
              Component watchers:
              Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: