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

Use of shorten_text() on question name, not reliable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.3, 1.9, 2.0
    • Fix Version/s: 1.8.4, 1.9, 2.0
    • Component/s: Questions
    • Labels:
      None
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      When the question name is derived from the question text, it is protected from excessive length using the shorten_text() function, as this only splits on word boundaries it is not guaranteed to bring the string in within the database field size for the name. This (particularly on Postgres) can be a case of database errors. Recommend adding a second substr() call to protect the field.

        Attachments

          Activity

            People

            • Assignee:
              howardsmiller Howard Miller
              Reporter:
              howardsmiller Howard Miller
              Tester:
              Nobody
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Jan/08