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

zip_packer function archive_to_pathname returns success state when no zip is created.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.4
    • Component/s: Files API
    • Labels:

      Description

      the function archive_to_pathname in lib/packer/zip_packer.php returns a success when no zip is created.

      this happens when the array of files passed into the function are invalid - I found this when accidentally passing in an array with reversed keys
      eg: ospathname=>archivepath
      instead of: archivepath=>ospathname

      no zip file is created as there are no valid files for the zip, but it still returns a succesful state. IMO if no zip is created, it should return an error state.

      code to reproduce:
      $filesforzipping['/home/me/dir/somefile.txt'] = 'somefile.txt';
      $filename = 'home/me/dir/newzip.zip';

      $zipper = new zip_packer();
      if ($zipper->archive_to_pathname($filesforzipping, $filename)

      { echo "success"; }

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            danmarsden Dan Marsden
            Integrator:
            Dan Poltawski
            Tester:
            Dan Poltawski
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Dec/12