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

kses_hair() stripping some CSS style attribute values

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 1.9.8
    • Component/s: General
    • Labels:
      None
    • Environment:
      All
    • Database:
      Any
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      When a multianswer quiz question containing some simple CSS gets printed on the screen, it is stripped of the first attribute name in the style definition. Example:

      Question in the DB:

      <div style=background: #EEEEFF; margin: 10px; border: medium solid #DDDDFF;>

      Question printed:

      <div style=#EEEEFF; margin: 10px; border: medium solid #DDDDFF; >

      It does not matter what is the name of the first attribute, the result is the same, for example, for this sequence:

      Question in the DB:

      <div style=border: medium solid #DDDDFF; background: #EEEEFF; margin: 10px; >

      Question printed:

      <div style=medium solid #DDDDFF; background: #EEEEFF; margin: 10px; >

      I was able to track down that calling the kses_hair() function when formatting the question text is causing the trouble. Full path is as follows:

      http://moodle.cvs.sourceforge.net/moodle/moodle/mod/quiz/questiontypes/multianswer/questiontype.php:

      print_question_formulation_and_controls() -> http://moodle.cvs.sourceforge.net/moodle/moodle/lib/weblib.php: format_text() -> clean_text() -> cleanAttributes() -> cleanAttributes2() -> http://moodle.cvs.sourceforge.net/moodle/moodle/lib/kses.php: kses_hair()

      I encountered this behaviour at my site and at moodle.org today, 6 March, 2005.

      I'm enclosing a sample cloze question I used for import.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Mar/10