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

core_user_external::user_description() expects preferences names are always PARAM_ALPHANUMEXT

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.3.2
    • Fix Version/s: None
    • Labels:
      None
    • Affected Branches:
      MOODLE_33_STABLE

      Description

      My WS client is calling core_user_get_users_by_field. While testing it against my account on moodle.org, I got the following exception:

      stdClass Object
      (
          [exception] => invalid_response_exception
          [errorcode] => invalidresponse
          [message] => Invalid response value detected
          [debuginfo] => preferences => Invalid response value detected: name => Invalid response value detected: Invalid external api response: the value is "editor_marklar/formats", the server was expecting "alphanumext" type
      )   
      

      It turns out that core_user_external::user_description() expects preferences names are always PARAM_ALPHANUMEXT. But there is no such restriction in the preferences API itself, nor is such requirement documented.

      By looking into moodle.org database, it is only this particular plugin's preference editor_marklar/formats violating the rule for now. All others see to be fine.

      We should either

      1. Be more benevolent to the preferences names and fix the external lib.
      2. Be more explicit on preferences names and perform the same validation in the get/set API too. If we go this way, we should start throwing developer debugging first and then eventually turn into hard requirement. Hopefully the Marklar editor author will be kind enough to change their plugin and perform an upgrade there.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              mudrd8mz David Mudrák (@mudrd8mz)
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: