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

Backup misses files if a directory name evaluates to false (eg. "0")

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.8.2, 1.9, 2.0
    • 1.6.6, 1.7.4, 1.8.4, 1.9, 2.0
    • Backup, Other
    • None
    • MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

    Description

      The backup_copy_dir and delete_dir_contents functions in the backup/lib.php file do not work correctly if there is a directory (or file?) name that evaluates to false (eg. "0"). This will result in files not being copied for backup or deleted correctly. In those functions, there is a while loop that uses
      $file=readdir($dir)
      as its condition which can return valid files that evaluate to false. It is handled correctly in other files with something like
      false !== ($file = readdir($handle))

      There are other occurrences in the code of this bug including admin/delete.php: delete_subdirectories and backup/bb/restore_bb.php: get_subdirs. There may be others as well.

      Attachments

        Issue Links

          Activity

            People

              nicolasconnault Nicolas Connault
              scturner Scott Turner
              Andrew Davis Andrew Davis
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Adrian Greeve, 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:
                11/Jan/08