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

dirname returns \ for directory beginning /something on windows, causes restore endless loop

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Backup
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      When trying to restore a backup on Windows, Apache and using PHP 5.2.13 the restore times out with:

      Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Group\Apache2\htdocs\moodle_201\backup\util\xml\parser\processors\grouped_parser_processor.class.php on line 138

      I checked the code and found:

          protected function grouped_parent_exists($path) {
              $parentpath = dirname($path);
              while ($parentpath != '/') {
                  if ($this->path_is_grouped($parentpath)) {
                      return $parentpath;
                  }
                  $parentpath = dirname($parentpath);
              }
              return false;
          }

      On windows dirname seems to behave quite oddly:

      dirname('/something');
       
      Returns: \

      This causes the while loop to loop endlessly and causes a timeout.

      See: http://php.net/manual/en/function.dirname.php

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stronk7 Eloy Lafuente (stronk7)
                Reporter:
                paul.dawson Paul Dawson
                Tester:
                Nobody
                Participants:
                Component watchers:
                Adrian Greeve, Mihail Geshoski, Peter Dias
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  24/Nov/10