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

Consider switching profile field shortname type from PARAM_TEXT to PARAM_ALPHANUMEXT

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7.4, 3.8, 3.9
    • Fix Version/s: None
    • Component/s: User management
    • Labels:
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE

      Description

      A little bit of history of the validation of profile fields shortnames:

      • Originally only PARAM_ALPHANUM was allowed.
      • In MDL-63068 we switched PARAM_TEXT plus some extra validation in define_validate_common() to ensure that only [a-zA-Z0-9_] are allowed.
      • No matter the clear note, there are some issues (not critical for now, because they are readers/getters that are adhering to the PARAM_TEXT trend. Last case is MDL-67641.

      So, this issue just proposes to change that PARAM_TEXT to PARAM_ALPHANUMEXT, knowing that the later also allows "-" (and define_validate_common() will continue controlling it). But, at very least, will prevent the proliferation of PARAM_TEXT that are way too much for this case.

      Ciao

      PS: BTW, I've already seen a couple of cases (recently) where we want to just enable {{[a-zA-Z0-9_] }} maybe we should consider adding some new type or adding some "extra" param to allow the regular expressions to be dynamically expanded when some more char is allowed.... note this is a side idea, it doesn't belongs strictly to this issue.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: