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

Upload users import parses CSV records with varying number of fields strangely.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.9
    • Component/s: Authentication, Enrolments
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Excel sometimes generates CSV files where some rows have less fields than others when the last fields on a row are empty.

      e.g.:
      username,course1,role1,course2,role2
      userid1,CF01,5,CF02,3
      userid2,CF05,5

      If the above file is uploaded then moodle fills in the missing fields in the 'userid2' row with CF02,3 from the row above.
      Better handling would be to assume those fields are blank.

      Caused by failure to clear $record variable between processing lines of CSV file.

      Solution is to add "unset($record);" on line 359 of admin/uploaduser.php (just after unset($user); ):

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              antgreen Anthony Green
              Tester:
              Nobody
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08