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

create_user_record requires ipaddress, does not work from scripts

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.9.5
    • 1.9.10, 2.0
    • Libraries
    • None
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE, MOODLE_20_STABLE

    Description

      If you call create_user_record from a script or anywhere where $_SERVER['REMOTE_ADDR'] and such are not defined. It will try to insert a user record where lastip is null. This doesn't work because the user table has a non-null constraint on lastip. As a result, things like ldap authentication are broken (see last few comments on MDL-17682).

      Suggestions:

      • Remove non-null constraint. This makes the most sense to me because a user that has just be created by a script shouldn't have a lastip.
      • default to '127.0.0.1' in case getremoteaddr() returns null

      Attachments

        1. mdl-19628-18.diff
          0.5 kB
        2. mdl-19628-19.diff
          0.5 kB
        3. mdl-19628-20.diff
          0.5 kB

        Issue Links

          Activity

            People

              dougiamas Martin Dougiamas
              trick Alan Trick
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                25/Oct/10