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

Comments in xmldb cause errors if they include '

XMLWordPrintable

    • PostgreSQL
    • MOODLE_18_STABLE
    • MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

      If you make a comment on a database table that has a ' in you get errors, at least in Postgres but it may apply to other database types as well.

      For example, I made the following change in my copy of lib/xmldb/generators/postgres7.class.php

      from

      $comment.= " IS '" . substr($xmldb_table->getComment(), 0, 250) . "'";

      to

      $comment.= " IS '" . addslashes(substr($xmldb_table->getComment(), 0, 250)) . "'";

      This fixed it but I'm not sure it's the right approach, also it probably affects other databases most of which I can't test on, so I think somebody who has a clue how that code works should fix it, not me.

      For now I have changed my comment to not include a ' symbol. I think this solution may be ok for 1.8.

            stronk7 Eloy Lafuente (stronk7)
            quen Sam Marshall
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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