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

Byte order mark at the beginning of import groups file fail the process with the confusing error message

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Requirements

      1. Must be tested on either MySQL or MariaDB

      Preparation

      1. Download the 4 test CSVs from this issue (test1.csv - test4.csv).

      Test 1 - Importing of groups with BOM characters

      1. Log in as admin and go to any course.
      2. In the cog, select More...
      3. Click in Users tab and then Groups.
      4. Click Import groups
      5. Download attached test1.csv and add to filepicker and then click Import groups button.
      6. Make sure two groups are created, Sec1 and Sec2 (click Continue on the confirmation page).
      7. Select group Sec1 and then click Edit group settings.
      8. Make sure the group description is "SaMW" and does not contain bom chars (SaMW�).

      Test 2 - New CSV delimiter field

      1. Return to the Groups page, and delete the 2 groups you just created (Sec1 and Sec2).
      2. Again, select Import groups to navigate to the group import page.
      3. Choose the same file (test1.csv), but this time select semicolon ; in the CSV delimiter field and click Import groups.
      4. Make sure you see an error.
      5. Now, choose the file test2.csv, select semicolon ; in the CSV delimiter field and click Import groups.
      6. Make sure the groups Semicolon1 and Semicolon2 are successfully imported.

      Test 3 - New Encoding field

      1. Click Continue to return to the group import page.
      2. Choose test3.csv, leave CSV delimiter as comma, and Encoding as UTF-8, then then click Import groups.
      3. Make sure you get an error.
      4. Now, try again, but set the Encoding to ISO-8859-6 and repeat the first step.
      5. Make sure the group arabic1 is imported.

      Test 4 - Invalid file

      1. Return to the groups import page.
      2. Try to import test4.csv, with the default CSV delimiter and Encoding.
      3. Make sure you get the error:

        There is something wrong with the format of the CSV file. Please check the number of headings and columns match, and that the delimiter and file encoding are correct: Invalid CSV file format - number of columns is not constant!
        

      Show
      Requirements Must be tested on either MySQL or MariaDB Preparation Download the 4 test CSVs from this issue (test1.csv - test4.csv). Test 1 - Importing of groups with BOM characters Log in as admin and go to any course. In the cog, select More... Click in Users tab and then Groups . Click Import groups Download attached test1.csv and add to filepicker and then click Import groups button. Make sure two groups are created, Sec1 and Sec2 (click Continue on the confirmation page). Select group Sec1 and then click Edit group settings . Make sure the group description is "SaMW" and does not contain bom chars (SaMW�). Test 2 - New CSV delimiter field Return to the Groups page, and delete the 2 groups you just created (Sec1 and Sec2). Again, select Import groups to navigate to the group import page. Choose the same file (test1.csv), but this time select semicolon ; in the CSV delimiter field and click Import groups . Make sure you see an error. Now, choose the file test2.csv , select semicolon ; in the CSV delimiter field and click Import groups . Make sure the groups Semicolon1 and Semicolon2 are successfully imported. Test 3 - New Encoding field Click Continue to return to the group import page. Choose test3.csv , leave CSV delimiter as comma, and Encoding as UTF-8, then then click Import groups . Make sure you get an error. Now, try again, but set the Encoding to ISO-8859-6 and repeat the first step. Make sure the group arabic1 is imported. Test 4 - Invalid file Return to the groups import page. Try to import test4.csv , with the default CSV delimiter and Encoding. Make sure you get the error: There is something wrong with the format of the CSV file. Please check the number of headings and columns match, and that the delimiter and file encoding are correct: Invalid CSV file format - number of columns is not constant!
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_28_STABLE, MOODLE_310_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull from Repository:
    • Pull 3.8 Branch:
    • Pull 3.9 Branch:
    • Pull Master Branch:
      MDL-26401-master
    • Story Points:
      0
    • Sprint:
      International 4.0 - Sprint 3, International 4.0 - Sprint 4

      Description

      Import Groups from the .csv fails in Moodle 2.0.1+ (Build: 20110209)
      Tested on QA site with the file that works ok in 1.9 (attached)

      Error message:

      Error writing to database

      Debug info:
      Stack trace:

      • line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
      • line 874 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 916 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      • line 135 of /group/lib.php: call to mysqli_native_moodle_database->insert_record()
      • line 171 of /group/import.php: call to groups_create_group()

        Attachments

        1. char.png
          char.png
          54 kB
        2. import.csv
          0.0 kB
        3. import-1.csv
          0.0 kB
        4. Screenshot_1.png
          Screenshot_1.png
          83 kB
        5. Screenshot_2.png
          Screenshot_2.png
          57 kB
        6. test1.csv
          0.0 kB
        7. test2.csv
          0.1 kB
        8. test3.csv
          0.0 kB
        9. test4.csv
          0.1 kB

          Issue Links

            Activity

              People

              Assignee:
              lameze Simey Lameze
              Reporter:
              elenaivanova Elena Ivanova
              Peer reviewer:
              Michael Hawkins
              Integrator:
              Andrew Nicols
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              9 Vote for this issue
              Watchers:
              17 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 days, 1 hour, 31 minutes
                  4d 1h 31m