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

Filter applies multiple times for labels

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Filters
    • Labels:
      None
    • Environment:
      Using latest version from git 51f96f5bd94294e0ff6fbab74e8dbb34d571c9e0 .
    • Database:
      Any
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Filters 2.0 do not work correctly when displaying a label in a course.
      I have created a simple filter:
      function filter($text)

      { return str_replace('world', 'world hello world!', $text); }

      When text "world" is used in a resource, filter works as expected, but in label string "world" is replaced multiple times.
      For a given text in a label:
      "world"
      filter will behave like this:
      1. replace "world" with "world hello world!"
      2. replace each "world" inside "world hello world!" with "world hello world!"

      This gives the end result:
      "world hello world! hello world hello world!!"

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stronk7 Eloy Lafuente (stronk7)
                Reporter:
                tmuras Tomasz Muras
                Tester:
                Nobody
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  24/Nov/10