Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29276 META- Web service improvements for 2.2
  3. MDL-29277

Making the exception message during return values validation more explicit (and also during parameter validation)

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1
    • Fix Version/s: 2.2
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Set debug mode to 'developer'. MDL-29435 must be fixed in order to test with SOAP/XMLRPC

      Error: wrong parameter primary type at 3rd level:
      ----------------------------------------------------------------------
      1- in user/externallib.php::create_users_parameters change "users>customfields>type": PARAM_ALPHANUMEXT for PARAM_INT.
      Call the function with the built-in REST client in the admin. Check that the error message let you know exactly where is the issue, what value is faulty, and what value were expected. Obviously you must have a customfield.

      Error: wrong response primary type at 3rd level (cannot be test with REST, REST server does not validate return value, see MDL-29459):
      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      2- in user/externallib.php::get_users_by_id_returns change "customfields>type": PARAM_ALPHANUMEXT for PARAM_INT.
      Call the function with the built-in SOAP client in the admin. Check that the error message let you know exactly where is the issue, what value is faulty, and what value were expected. Obviously you must call a user that return a customfield.

      Error: send string, expecting array
      -------------------------------------------------
      3. Use the REST demo client: https://github.com/moodlehq/sample-ws-clients/tree/master/PHP-REST. Change this line

      $params = array('users' => '$users'); //previously $params = array('users' => $users);

      The error message should be clear where is the issue, telling you what value is wrong.

      Show
      Set debug mode to 'developer'. MDL-29435 must be fixed in order to test with SOAP/XMLRPC Error: wrong parameter primary type at 3rd level: ---------------------------------------------------------------------- 1- in user/externallib.php::create_users_parameters change "users>customfields>type": PARAM_ALPHANUMEXT for PARAM_INT. Call the function with the built-in REST client in the admin. Check that the error message let you know exactly where is the issue, what value is faulty, and what value were expected. Obviously you must have a customfield. Error: wrong response primary type at 3rd level (cannot be test with REST, REST server does not validate return value, see MDL-29459 ): ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2- in user/externallib.php::get_users_by_id_returns change "customfields>type": PARAM_ALPHANUMEXT for PARAM_INT. Call the function with the built-in SOAP client in the admin. Check that the error message let you know exactly where is the issue, what value is faulty, and what value were expected. Obviously you must call a user that return a customfield. Error: send string, expecting array ------------------------------------------------- 3. Use the REST demo client: https://github.com/moodlehq/sample-ws-clients/tree/master/PHP-REST . Change this line $params = array('users' => '$users'); //previously $params = array('users' => $users); The error message should be clear where is the issue, telling you what value is wrong.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull Master Branch:

      Description

      Making the exception message of "invalid return value" more explicit too - at least knowing which attribut of the return value is concerned.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    5/Dec/11