Moodle
  1. Moodle
  2. MDL-25027

Web Service moodle_user_create_users() does not accept leading/trailing spaces in firstname / lastname

    Details

    • Testing Instructions:
      Hide

      1) turn on web services under advanced features.
      2) plugins->web services -> external services , create a web service
      3) define in the GUI, a web services function that creates moodle users using 'moodle_user_create_users'
      4) call the web service with a web services test client (some can be cloned from here : git@github.com:moodlehq/sample-ws-clients.git )
      5) check that it can create firstname and lastnames with spaces in it.

      Please test MDL-30878 also. Part of this patch was removed for testing MDL-30878.

      Show
      1) turn on web services under advanced features. 2) plugins->web services -> external services , create a web service 3) define in the GUI, a web services function that creates moodle users using 'moodle_user_create_users' 4) call the web service with a web services test client (some can be cloned from here : git@github.com:moodlehq/sample-ws-clients.git ) 5) check that it can create firstname and lastnames with spaces in it. Please test MDL-30878 also. Part of this patch was removed for testing MDL-30878.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-25027_stable_consistency_fix
    • Rank:
      920

      Description

      Users can be added with leading/trailing spaces in firstname and lastname via the GUI form. However, the same values submitted via web services will cause an exception to be thrown.

      This appears to be because the create_users service runs the data through truncate_userinfo() and throws an exception if it is returned modified in anyway. truncate_userinfo() has a call to trim() which strips the spaces. The fields are of type PARAM_NOTAGS which allows the spaces.

        Issue Links

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: