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

    • Type: Bug
    • Status: Waiting for peer review
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1, 2.8.1, 3.5.2, 3.6
    • Fix Version/s: None
    • Component/s: Groups
    • Labels:
    • Testing Instructions:
      Hide

      To test the fix for the BOM please conduct the following steps:

      1. If you do not have a course create one (`admin/tool/generator/maketestcourse.php`).

      2. In the course go to `Participants/Groups.`

      3. On the bottom of the page go to `Import groups`.

      4. Upload a file with BOM encoding. The simplest way to create one for me was just create it in bash (```printf '\xEF\xBB\xBF' > with_bom.txt cat source_file.txt >> with_bom.tx```). Alternatively, you can use Notepad++ and in the tap Encoding change to one of the options with BOM. The "real" content of the file should contain at least the column `groupname`.

      5. Click Import groups.

      6. Check if all groups are correctly uploaded and created.

      To test the fix for the whitespace please conduct the following steps:

      1. If you do not have one create a Moodle Instance with a MySQL Database
      2. If you do not have a course create one (`admin/tool/generator/maketestcourse.php`).
      3. In the course go to `Participants/Groups`.
      4. On the bottom of the page go to `Import groups`.
      5. Upload a file with Unicode blank spaces.
      6. Click Import groups.
      7. Check if all groups are correctly uploaded and created.

      Show
      To test the fix for the BOM please conduct the following steps: 1. If you do not have a course create one (`admin/tool/generator/maketestcourse.php`). 2. In the course go to `Participants/Groups.` 3. On the bottom of the page go to `Import groups`. 4. Upload a file with BOM encoding. The simplest way to create one for me was just create it in bash (```printf '\xEF\xBB\xBF' > with_bom.txt cat source_file.txt >> with_bom.tx```). Alternatively, you can use Notepad++ and in the tap Encoding change to one of the options with BOM. The "real" content of the file should contain at least the column `groupname`. 5. Click Import groups. 6. Check if all groups are correctly uploaded and created. To test the fix for the whitespace please conduct the following steps: 1. If you do not have one create a Moodle Instance with a MySQL Database 2. If you do not have a course create one (`admin/tool/generator/maketestcourse.php`). 3. In the course go to `Participants/Groups`. 4. On the bottom of the page go to `Import groups`. 5. Upload a file with Unicode blank spaces. 6. Click Import groups. 7. Check if all groups are correctly uploaded and created.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_28_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull Master Branch:
      fix/MDL-26401

      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

          Activity

            People

            • Votes:
              8 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated: