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
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.
- will help resolve
MDL-8605 Reduce the number of dirs under the users file area