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

Incorrectly formatted text in XML causes Glossary Import infinite loop

XMLWordPrintable

    • MOODLE_31_STABLE

      If a glossary import is not correctly formatted (I.e. "&" instead of "& amp ;" in the text entry), Moodle gets in an infinite loop.

      With debugging enabled, the following error gets flooded into the error_log;

      [Fri Aug 12 09:18:37.181097 2016] [:error] [pid 11166] [client 10.2.10.49:52225] PHP Warning:  strcmp() expects parameter 1 to be string, array given in /var/www/moodles/stable_31/moodle/lib/weblib.php on line 1589, referer: http://dan.local/stable_31/mod/glossary/import.php?id=66
      

      It's failing in the trusttext_strip function of weblib.php on the following IF statement;

      if (strcmp($orig, $text) === 0) {
                  return $text;
              }
      

      This had caused an issue for us recently where Moodle debugging was set to "Normal" and the client attempted to upload a Glossary import with such an error in the XML file.

      The httpd process got stuck in an infinite loop, spouting out this error - filling the error_log and causing the disk space to fill up rapidly.

      Moodle should fail the import if there is a format issue and not get stuck in an infinite loop.

      How this error appeared in the XML file is another question (manual entry perhaps) as this should never happen if it is exported from a Moodle site. But Moodle shouldn't get stuck if such an error is found.

            Unassigned Unassigned
            danbennett Dan Bennett
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.