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

line breaks counted differently by server/client-side maxlength form validation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.9.17, 3.11.10, 4.0.4, 4.0.8, 4.2, 4.3
    • Forms Library
    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE

      Line breaks within textarea form elements are counted differently between server and client side validation of the maxlength rule. The client side validation counts a line break as a single character while the validation on the server counts it as two.

      Browsers usually send the CR and LF for a line break. I also tested umlaute (ä, ö, ü) and other non-ASCII characters since I suspected byte vs. UTF code point count but I was only able to reproduce the behaviour with line breaks.

      I used the attached PHP script for manual testing. I verified that the issue is present in current master branch.

            Unassigned Unassigned
            jojoob Johannes Burk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

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