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

ICS file import fails to import to database if the file does not contain a UID



    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.6.4, 3.6.5, 3.7, 3.7.1
    • Fix Version/s: None
    • Component/s: Calendar
    • Labels:
    • Affected Branches:


      The current system for importing an ics file does not check if the ical file contains a valid UID.

      Most ical inputs from sites like eventbrite and webinar sites do not contain an ID/UID that moodle can pick up. The bug is when uploading there is no UID assigned to field 5

      Upon importing the ICS file, the array is to be written needs a valid UUID value, which with these ICS files is null. This causes a dmlwriteexception.

      This quick 'isset' checks to see if uid is null, and if it is, just puts a quick value in there so the database write passes and the calendar item is added right.

      The error is as follows, using the ics file from eventbrite here: https://www.eventbrite.co.uk/e/london-film-comic-con-summer-2019-tickets-49472593860

      Error code: dmlwriteexception

      • line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
      • line 1329 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 1375 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->" while reading response header from upstream, client:, server: lunamoodle, request: "POST /calendar/managesubscriptions.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "", referrer: ""
        2019/07/05 15:50:15 [error] 1419#1419: *2934 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: UID in /var/www/html/moodle/calendar/lib.php on line 2853PHP message: PHP Notice: Trying to get property 'value' of non-object in /var/www/html/moodle/calendar/lib.php on line 2853PHP message: Default exception handler: Error writing to database Debug: Column 'uuid' cannot be null
        INSERT INTO mdl_event (name,description,timestart,timeduration,location,uuid,timemodified,subscriptionid,userid,groupid,courseid,categoryid,eventtype,format) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)
        [array (
        0 => 'LONDON Film & Comic Con SUMMER 2019',
        1 => 'For details, click here: https://www.eventbrite.co.uk/e/london-film-comic-con-summer-2019-tickets-49472593860',
        2 => 1564131600,
        3 => 205200,
        4 => 'Olympia London - Hammersmith Rd, - Hammersmith - W14 8UX - United Kingdom',
        5 => NULL,
        6 => 1562338215,
        7 => 12,
        8 => '2',
        9 => '0',
        10 => '0',
        11 => '0',
        12 => 'user',
        13 => '1',




            • Assignee:
              darryl-harley darryl-harley
              Component watchers:
              Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: