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

get_site_info WS fails if usermaxuploadfilesize overflows PARAM_INT

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.3, 3.2.5
    • Fix Version/s: 3.2.6, 3.3.3
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Set up

      1. In the database, edit the {prefix}_config table, add or change the existing userquota setting with a new value higher than your local PHP_INT_MAX
      2. As admin in your site purge cache
      3. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings

      Mobile app

      1. Acess to the site using the mobile app
      2. Confirm you don't receive any error, and you are able to browse the site

      Web services

      • For Moodle 3.4:
        1. From Site administration ► Development ► Web service test client, execute the core_webservice_get_site_info function. Use Authentication method = token and a non-admin user token.
        2. Check that you receive a userquota that is equal to your PHP_INT_MAX
      • For Moodle 3.2, 3.3 and even 3.4:
        1. Call WS from command line using the following sentence: curl 'http://localhost/m/stable_XX/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_webservice_get_site_info&wstoken=XXXXXXXXXXXXXXXXXXXXX' | python -m "json.tool" . You will need to change:
          • stable_XX for the corresponding Moodle URL
          • XXXXXXXXXXXXXXXXXXXXX for the non-admin user token
        2. Check that you receive a userquota that is equal to your PHP_INT_MAX

       

      IMPORTANT: If you need a token, please generate it via Site administration ► Plugins ► Web services ► Manage tokens, and associate it to a non admin user (for admin users behaviour will be different)

      Show
      Set up In the database, edit the {prefix}_config table, add or change the existing userquota setting with a new value higher than your local PHP_INT_MAX As admin in your site purge cache As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Mobile app Acess to the site using the mobile app Confirm  you don't receive any error, and you are able to browse the site Web services For Moodle 3.4: From Site administration ► Development ► Web service test client, execute the core_webservice_get_site_info function. Use Authentication method = token and a non-admin user token. Check that you receive a userquota that is equal to your PHP_INT_MAX For Moodle 3.2, 3.3 and even 3.4: Call WS from command line using the following sentence: curl 'http://localhost/m/ stable_XX /webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_webservice_get_site_info&wstoken= XXXXXXXXXXXXXXXXXXXXX ' | python -m "json.tool" . You will need to change: stable_XX for the corresponding Moodle URL XXXXXXXXXXXXXXXXXXXXX for the non-admin user token Check  that you receive a userquota that is equal to your PHP_INT_MAX   IMPORTANT : If you need a token, please generate it via Site administration ► Plugins ► Web services ► Manage tokens, and associate it to a non admin user (for admin users behaviour will be different)
    • Affected Branches:
      MOODLE_30_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-53501-master

      Description

      Yesterday we received a message from a Moodle admin that couldn't login in her site using the Moodle Mobile app. We checked what was going on and we found out that the get_site_info WS was returning this error:

      usermaxuploadfilesize => Invalid response value detected: Invalid external api response: the value is "10485760000", the server was expecting "int" type
      

      This value comes from this setting:

      Site Administration > Security > Site Policies > Maximum uploaded file size

      The max value of the setting depends on the server configuration, so it can overflow an integer and cause the WS to fail.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17