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

get_max_upload_file_size() fails to determe max upload size when set to large figure

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_26_STABLE

      Description

      I encountered the following error when running the unit tests...

      1) core_moodlelib_testcase::test_get_max_upload_sizes
      PHPUnit_Framework_Exception: Argument #1 of PHPUnit_Framework_Assert::assertArrayHasKey() must be a integer or string
       
      D:\xampp\htdocs\master_integration\lib\tests\moodlelib_test.php:2162
      D:\xampp\htdocs\master_integration\lib\phpunit\classes\advanced_testcase.php:80
       
      To re-run:
       \xampp\php\phpunit core_moodlelib_testcase lib\tests\moodlelib_test.php
      

      This appears to be caused by the fact that get_max_upload_file_size() is returning nothing when my upload limit is set to 2GB (2048MB for post_max_size and upload_max_filesize in php.ini).

      It looks like this is caused because my PHP instance is 32bit (running on a 64bit machine) and 2147483648 exceeds limits.

      The list of possible upload limits provided by get_max_upload_sizes() is...

      [0] => Site upload limit (2GB)
      [104857600] => 100MB
      [52428800] => 50MB
      [20971520] => 20MB
      [10485760] => 10MB
      [5242880] => 5MB
      [2097152] => 2MB
      [1048576] => 1MB
      [512000] => 500KB
      [102400] => 100KB
      [51200] => 50KB
      [10240] => 10KB
      [-2147483648] => 2GB
      

      Oddly, the limiting of file sizes seems to work still, although I haven't tested this very extensively. I assume this is because the site limit of zero is being used.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                salvetore Michael de Raadt
                Participants:
                Component watchers:
                Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Matteo Scaramuccia, Jake Dallimore, Jun Pataleta, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: