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

Windows ZipArchive::close() errors with PHPUnit

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.10, 4.0
    • 3.10
    • Privacy, Unit tests

    Description

      These errors have been detected recently under windows and are consistently reproducible with Moodle 3.10 and master.

      • travis: https://travis-ci.com/github/stronk7/moodle/jobs/400704270
      • locally:

        $  vendor/bin/phpunit --filter moodle_content_writer_test::test_export_user_preference_context_course
         
        PHPUnit test environment setup complete.
        Moodle 3.10dev+ (Build: 20201009), 69959c371f74398b2a44893f19f6a3af2534e1b2
        Php: 7.2.12, pgsql: 10.6, OS: Windows NT 10.0 AMD64
        PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
         
        ...EEE                                                              6 / 6 (100%)
         
        Time: 11.42 seconds, Memory: 464.00 MB
         
        There were 3 errors:
         
        1) moodle_content_writer_test::test_export_user_preference_context_course with data set "basic" ('core_privacy', 'onekey', 'value', 'description')
        ZipArchive::close(): Read error: No such file or directory
         
        C:\Users\stronk7\git_moodle\integration\lib\filestorage\zip_archive.php:225
        C:\Users\stronk7\git_moodle\integration\lib\filestorage\zip_packer.php:154
        C:\Users\stronk7\git_moodle\integration\privacy\classes\local\request\moodle_content_writer.php:694
        C:\Users\stronk7\git_moodle\integration\privacy\tests\moodle_content_writer_test.php:1225
        C:\Users\stronk7\git_moodle\integration\privacy\tests\moodle_content_writer_test.php:618
        C:\Users\stronk7\git_moodle\integration\lib\phpunit\classes\advanced_testcase.php:80
        ...
        ...
        

      Also, it has been noticed (along this issue research) that all phpunit executions (and maybe others) are throwing some PHP Warnings with unlink() trying to remove non-existing directory:

      Warning: unlink(C:\Users\travis\roots\phpunitdata/_temp_2a60d2cfee1b184340eb76f43aeebba6/_temp_268c851d269a7830e5e6cb615777eb41/_temp_951be5e0378d9543d31b82c6ca468653/_temp_9c100731e36c8ad6f88291ae16b5faa4/_temp_0e223fb4008ddcec3a00d1e182116e19/bee124ad3a85b27799e56ad58e029cccf68b783b.cache): No such file or directory in C:\Users\travis\build\stronk7\moodle\lib\moodlelib.php on line 9878
      

      Reproducible with any OS.

      So this issue is about to try to fix both issues, both related/regressions of MDL-66928:

      1) Reduce unnecessary path length while keeping uniqueness guaranteed.
      2) Check and fix why those warnings are happening at the end of the execution, consistently.

      Attachments

        Issue Links

          Activity

            People

              brendanheywood Brendan Heywood
              stronk7 Eloy Lafuente (stronk7)
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Jun Pataleta Jun Pataleta
              CiBoT CiBoT
              Andrew Lyons, Adrian Greeve, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Nov/20

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 46 minutes
                  2h 46m