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

Deleting a user causes incorrect 'usernamelowercase' error with user_update_user function

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • None
    • 2.6.1, 2.7.3, 2.8.1
    • Authentication
    • MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE

      NOTE: This only affects the deletion of users where the email field is empty - e.g. in cases where the account was created via an import.

      Line 109 of user/lib.php

      if ($user->username !== core_text::strtolower($user->username)

      The code above is comparing values AND types.
      When I get the error with 'usernamelowercase' it isn't because the strings don't match, its because $user->username is a double and the value returned by core_text::strtolower($user->username) is a string.

      There are many possible fixes for this

      1) remove an equals sign from line 109 of user/lib.php

      if ($user->username != core_text::strtolower($user->username)

      2) force a string value on the username on line 109 of user/lib.php

      if (strval($user->username) !== core_text::strtolower($user->username)

      3) force a string value on the username on line 4249 of moodlelib.php

      $updateuser->username = strval($delname);

            poltawski Dan Poltawski
            brudinie guy thomas
            Votes:
            6 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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