Moodle
  1. Moodle
  2. MDL-20245

Allow bigger values (up to 1333 chars) in user preferences, alleviating some problems with grader report

    Details

    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      1) Go into the grader report for a course containing several categories. Collapse and re-expand several of them by clicking the +, o, - symbol next to the category name. Check that they can be collapsed and re-expanded.

      2) Run the lib/simpletest/testmoodlelib.php unit tests. Not failure related with "test_set_user_preference" should happen. That ensures that storage up to 1333 chars is working ok.

      Show
      1) Go into the grader report for a course containing several categories. Collapse and re-expand several of them by clicking the +, o, - symbol next to the category name. Check that they can be collapsed and re-expanded. 2) Run the lib/simpletest/testmoodlelib.php unit tests. Not failure related with "test_set_user_preference" should happen. That ensures that storage up to 1333 chars is working ok.
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull Master Branch:
      MDL-20245_user_preferences2
    • Rank:
      1181

      Description

      Noticed in my Postgres log that inserts into the user_preference table have been failing. Here is the log entry:

      ERROR: value too long for type character varying(255)
      STATEMENT: UPDATE mdl_user_preferences SET value = 'a:2:{s:14:\"aggregatesonly\";a:11:

      {i:41;s:4:\"1621\";i:46;s:4:\"1466\";i:47;s:4:\"1498\";i:48;s:4:\"1470 \";i:49;s:4:\"1622\";i:50;s:4:\"1623\";i:51;s:4:\"1465\";i:52;s:4:\"1668\";i:53;s:4:\"1669\";i:54;s:4:\"1670\";i:55;s:4:\"1671\";}

      s:10:\"gradesonly\";a:2:{i:1;s:4:\"1620\";i:2;s:4:\"3024\";}}' WHERE id =
      '1619';

      A quick look at the DB for the record in question:

      select * from mdl_user_preferences where id = '1619';
      id | userid | name | value
      ---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      1619 | 12405 | grade_report_grader_collapsed_categories | a:2:{s:14:"aggregatesonly";a:11:

      {i:41;s:4:"1621";i:46;s:4:"1466";i:47;s:4:"1498";i:48;s:4:"1470";i:49;s:4:"1622";i:50;s:4:"1623";i:51;s:4:"1465";i:52;s:4:"1668";i:53;s:4:"1669";i:54;s:4:"1670";i:55;s:4:"1671";}

      s:10:"gradesonly";a:1:{i:1;s:4:"1620";}}

      Unfortunately, I cannot determine how exactly this was triggered. I
      cannot decipher exactly what was being clicked on by the user at the
      time these things were logged. Any tips on recreating the problem?

      If I were to guess, I would say that there is a problem where a
      person may belong to too many courses with too many categories and
      have PHP pref arrays that don't serialize to a small enough value.
      Perhaps the size of the serialized value should be checked or else a
      note presented to the user to that the settings were not saved?

        Issue Links

          Activity

            People

            • Votes:
              34 Vote for this issue
              Watchers:
              27 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: