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

check_dir_exists in safe_mode is buggy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.8.4, 1.9, 2.0
    • 1.8.2
    • Backup
    • None
    • Linux (Debian Etch), Apache 2.2.3-4+etch1, PHP5 5.2.0-8+etch7 with safe_mode turned on
    • MOODLE_18_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      When using safe_mode the is_dir() function might return a wrong result. My Moodle files are owned by www-data, the CFG->moodledata is in /var/local/moodledata. When checking is_dir('/var/') (like in lib/moodlelib.php:6771) PHP returns boolean(false); /var/ is owned by root and thus PHP returns false (for security reasons?!?). This results in errors when importing a course into another.

      It might be better to strip off the CFG->moodledata before recursively checking and creating directories. This directory should already exist anyway when calling this method. It even saves some execution time.

      Strip off CFG->moodledata (there might be another way that is more foolproof, this is just a quick workaround):

      $dir = str_replace($CFG->dataroot.'/', '', $dir);

      Start with $dir = CFG->dataroot:

      $dir = $CFG->dataroot.'/';

      See the patch for more information.

            stronk7 Eloy Lafuente (stronk7)
            resamsel René Samselnig (Inactive)
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.