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

invalid iconurl in LTI module causes corrupt modinfo and course no longer loads.

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Test 1 (on any DB except postgres, start before patch):

      1. Create an "External tool" activity and specify icon URL.
      2. Make sure the icon is displayed on course view page.
      3. Apply the patch
      4. Make sure the icon is still displayed on course view page.
      5. Make any change to the course that results in rebuilding the cache (move, hide, add or edit any activity or section)
      6. View course page and make sure the icon is displayed on course view page

      Test 2 (on postgres DB, after patch):

      1. Create an "External tool" activity and specify icon URL.
      2. Make sure the icon is displayed on course view page.
      Show
      Test 1 (on any DB except postgres, start before patch): Create an "External tool" activity and specify icon URL. Make sure the icon is displayed on course view page. Apply the patch Make sure the icon is still displayed on course view page. Make any change to the course that results in rebuilding the cache (move, hide, add or edit any activity or section) View course page and make sure the icon is displayed on course view page Test 2 (on postgres DB, after patch): Create an "External tool" activity and specify icon URL. Make sure the icon is displayed on course view page.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull Master Branch:
      wip-MDL-36690-master

      Description

      this was a weird one to trace and I couldn't reproduce it on qa.moodle.net

      Add an external tool to a course and use the url:
      http://www.moonsaildesign.com/typography/inspiring-typographic-artists/

      paste that exact url into both the Launch URL and icon URL fields and the course no longer loads as the modinfo becomes corrupt/truncated (invalid icon url)

      The following errors are shown:

      Notice: unserialize(): Error at offset 2577 of 2580 bytes in C:\moodle\moodle-prod\wwwroot\lib\modinfolib.php on line 245

      Notice: unserialize(): Error at offset 2577 of 2580 bytes in C:\moodle\moodle-prod\wwwroot\lib\modinfolib.php on line 250
      Problem with "modinfo" data for this course

      line 253 of \lib\modinfolib.php: call to debugging()
      line 1260 of \lib\modinfolib.php: call to course_modinfo->__construct()
      line 1928 of \lib\navigationlib.php: call to get_fast_modinfo()
      line 1989 of \lib\navigationlib.php: call to global_navigation->generate_sections_and_activities()
      line 47 of \course\format\topics\lib.php: call to global_navigation->load_generic_course_sections()
      line 1903 of \lib\navigationlib.php: call to callback_topics_load_content()
      line 1257 of \lib\navigationlib.php: call to global_navigation->load_course_sections()
      line 3043 of \lib\navigationlib.php: call to global_navigation->initialise()
      line 781 of \lib\pagelib.php: call to navbar->has_items()
      line 4 of \theme\ucol\layout\default.php: call to moodle_page->has_navbar()
      line 768 of \lib\outputrenderers.php: call to include()
      line 715 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
      line 232 of \course\view.php: call to core_renderer->header()

      Warning: array_slice() expects parameter 1 to be array, null given in C:\moodle\moodle-prod\wwwroot\lib\navigationlib.php on line 1929

      Warning: Invalid argument supplied for foreach() in C:\moodle\moodle-prod\wwwroot\lib\navigationlib.php on line 1932

      Warning: Invalid argument supplied for foreach() in C:\moodle\moodle-prod\wwwroot\lib\navigationlib.php on line 2008

      Error writing to database

      More information about this error
      Debug info: ERROR: duplicate key value violates unique constraint "mdl_coursect_cousec_uix"
      INSERT INTO mdl_course_sections (course,section,visible,summaryformat) VALUES($1,$2,$3,$4) RETURNING id
      [array (
      'course' => '991',
      'section' => 0,
      'visible' => 1,
      'summaryformat' => '1',
      )]
      Error code: dmlwriteexception
      Stack trace:

      line 410 of \lib\dml\moodle_database.php: dml_write_exception thrown
      line 239 of \lib\dml\pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 812 of \lib\dml\pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 864 of \lib\dml\pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
      line 267 of \course\view.php: call to pgsql_native_moodle_database->insert_record()

      If I look at modinfo for the course I see it ends with:
      "iconurl";O:10:"moodle_url":9:{s:9:""

      • no closing curly brace and the url to the iconurl isn't shown.

      it would be good to have some improved validation on the editing page for the external tool to prevent an invalid url being entered into the icon url and prevent modinfo from ending up in a corrupt state.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Sep/13