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

When section name limit is exceeded no suitable error is provided.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.6, 2.5.2, 2.6
    • Fix Version/s: 2.4.7, 2.5.3
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide
      1. Go to www.lipsum.com and generate a 256 character string such as "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sollicitudin fermentum justo sit amet tempor. Proin sed lorem mollis neque interdum consectetur eu quis ipsum. Duis dictum quis lectus egestas suscipit. Pellentesque viverra, libero vel sed."
      2. Create a course with the 'Topics' format.
      3. Edit the section summary for section 1.
      4. Click off 'Use default section name'.
      5. Copy / paste the supplied text in the 'Section name' box.
      6. Click on 'Save changes'.
      7. Observe the error 'Error writing to database More information about this error'.
      8. Click on 'Continue'.
      9. Observe the error 'A required parameter (id) was missing More information about this error'.
      10. Click on 'Continue'.
      11. Go back to the course.
      12. Apply the patch.
      13. Edit the section summary for section 1.
      14. Click off 'Use default section name'.
      15. Copy / paste the supplied text in the 'Section name' box.
      16. Confirm that the end period has been removed from the text so that it reads "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sollicitudin fermentum justo sit amet tempor. Proin sed lorem mollis neque interdum consectetur eu quis ipsum. Duis dictum quis lectus egestas suscipit. Pellentesque viverra, libero vel sed" and therefore is not greater than 255 characters.

      Now, let's hack a bit and change this line (#30):

      https://github.com/gjb2048/moodle/compare/master...wip-MDL-42270_master_2#diff-84752bcc4372387af8c038da4d9322b3R30

      so both "255" occurrences are modified to "20". So the form will continue allowing 255, but the validation will be show if we use more than 20 chars.

      Once hacked:

      1) Go to any section and edit it.
      2) Click off 'Use default section name'.
      3) Add some text 20 chars long. Save. It will be saved ok.
      4) Edit the same section.
      5) Add 1 more char (so it will be 21 long). Save. The length error message is shown.

      That's all.

      Show
      Go to www.lipsum.com and generate a 256 character string such as "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sollicitudin fermentum justo sit amet tempor. Proin sed lorem mollis neque interdum consectetur eu quis ipsum. Duis dictum quis lectus egestas suscipit. Pellentesque viverra, libero vel sed." Create a course with the 'Topics' format. Edit the section summary for section 1. Click off 'Use default section name'. Copy / paste the supplied text in the 'Section name' box. Click on 'Save changes'. Observe the error 'Error writing to database More information about this error'. Click on 'Continue'. Observe the error 'A required parameter (id) was missing More information about this error'. Click on 'Continue'. Go back to the course. Apply the patch. Edit the section summary for section 1. Click off 'Use default section name'. Copy / paste the supplied text in the 'Section name' box. Confirm that the end period has been removed from the text so that it reads "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sollicitudin fermentum justo sit amet tempor. Proin sed lorem mollis neque interdum consectetur eu quis ipsum. Duis dictum quis lectus egestas suscipit. Pellentesque viverra, libero vel sed" and therefore is not greater than 255 characters. Now, let's hack a bit and change this line (#30): https://github.com/gjb2048/moodle/compare/master...wip-MDL-42270_master_2#diff-84752bcc4372387af8c038da4d9322b3R30 so both "255" occurrences are modified to "20". So the form will continue allowing 255, but the validation will be show if we use more than 20 chars. Once hacked: 1) Go to any section and edit it. 2) Click off 'Use default section name'. 3) Add some text 20 chars long. Save. It will be saved ok. 4) Edit the same section. 5) Add 1 more char (so it will be 21 long). Save. The length error message is shown. That's all.
    • Workaround:
      Hide

      None.

      Show
      None.
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-42270_master_2

      Description

      On https://moodle.org/mod/forum/discuss.php?d=241466, Paul K reported that no suitable error message was given to the users when they entered over the limit for the section name.

      Upon inspection of 'install.xml' the size of the 'name' attribute in the 'course_sections' table is 255 and this is not being checked by the method 'validation' in '/course/editsection_form.php'.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Nov/13