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



      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
      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.

            Unassigned Unassigned
            salvetore Michael de Raadt
            0 Vote for this issue
            2 Start watching this issue


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