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

Policy (and other) HTML can break with multilang

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.9.2
    • Fix Version/s: None
    • Component/s: Filters, HTML and CSS, Language
    • Labels:
      None
    • Affected Branches:
      MOODLE_39_STABLE

      Description

      I originally thought this was Atto-related, but it turns out the same thing happens when you set your HTML editor preference to be the basic text editor.

      I also thought it only applied to the user policy editor, (where this effect can be seen both in the policy and the summary) but later found other places that it affects.

      It seems that any mildly complex HTML in combination with the multi-lang filter will cause problems, but not in every location where you can enter text.

      <span lang="en" class="multilang">
      <p>english</p></span>
      <span lang="fr" class="multilang">
      <p>french</p></span>

      When the above is saved something, I'm not sure what, is rewriting that so that it looks like this:

      <span lang="en" class="multilang">
      </span><p>english</p>
      <span lang="fr" class="multilang">
      </span><p>french</p>

      and therefore breaking the multilang behaviour, as the spans no longer wrap the relevant text.

      Without any html tags like <p> or <div> inside the span, it works as expected.

      Also, the same thing appears to work fine in some places, e.g. a label or a a desciption for a forum, but then not in a forum post, where the same behaviour is seen.

      Possibly this is something to do with security, and some areas are put through more extensive checks than others for XSS etc?

      Worth noting that technically, divs, p tags etc. aren't allowed inside spans, but I believe that's what you need to use for this multilang filter. (I think there is a 3rd party one that supports using {} instead of html tags).

       

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            bawjaws David Scotson
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Amy Groshek, David Scotson, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), David Mudrák (@mudrd8mz), Helen Foster, Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: