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

Order of filter not being respected for a mod_label (probably others)

    Details

    • Testing Instructions:
      Hide

      I did not elaborate a unit test due to the complexity of filter_preload_activities() and my limited time to work on this issue.

      To manually test it:

      1. Enable to url to link filter in site administration > plugins > filters > manage filters
      2. Apply the filter to all formats in site administration > plugins > filters > convert urls into links and images
      3. In a course, create an assignment, set the description to a URL such as http://www.moodle.org (just the URL, do not create a link).
      4. In a course, create a label activity, set it to a URL such as http://www.moodle.org (just the URL, do not create a link).
      5. Both URLs, which are not links, are displayed as links when rendered because of the urltolink filter.
      6. Now open the filter settings to see the configured order: site administration > plugins > filters > manage filters
      7. Now please place a breakpoint on apply_filter_chain() of file lib/filterlib.php
      8. When viewing the assignment, inspect $filterchain and you will see the order is correct.
      9. When viewing the label, inspect $filterchain and you will see the order was wrong before the patch, but correct after the patch.

      In this case the order does not matter, but in my use case is different and involves a filter plugin that relies on another filter plugin and that is why the order is important.

      Show
      I did not elaborate a unit test due to the complexity of filter_preload_activities() and my limited time to work on this issue. To manually test it: Enable to url to link filter in site administration > plugins > filters > manage filters Apply the filter to all formats in site administration > plugins > filters > convert urls into links and images In a course, create an assignment, set the description to a URL such as http://www.moodle.org (just the URL, do not create a link). In a course, create a label activity, set it to a URL such as http://www.moodle.org (just the URL, do not create a link). Both URLs, which are not links, are displayed as links when rendered because of the urltolink filter. Now open the filter settings to see the configured order: site administration > plugins > filters > manage filters Now please place a breakpoint on apply_filter_chain() of file lib/filterlib.php When viewing the assignment, inspect $filterchain and you will see the order is correct. When viewing the label, inspect $filterchain and you will see the order was wrong before the patch, but correct after the patch. In this case the order does not matter, but in my use case is different and involves a filter plugin that relies on another filter plugin and that is why the order is important.
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull 3.1 Branch:
      MDL-58393-31_filter-order
    • Pull Master Branch:
      MDL-58393-33_filter-order

      Description

      When the filters are applied to activity modules "labels" it does not respect the filter order (maybe some other places as well).

      In most other situations the order is being respected correctly.

      This is probably related to MDL-41596

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    8/May/17