Updated: Comment #0

Problem/Motivation

  1. First and foremost: this is necessary to make PHPUnit tests not fragile, because all procedural functions have to be mocked.
  2. Also: Drupal generally wants to move functionality related to objects onto the objects and not keep them in procedural wrappers in .module files.

Proposed resolution

Move filter_get_filter_types_by_format() and filter_get_html_restrictions_by_format() onto FilterFormatInterface. This blocks the critical #2099741: Protect WYSIWYG Editors from XSS Without Destroying User Data issue (hence this is major), whose latest patch is adding unit tests that would otherwise need these functions to be mocked.

Remaining tasks

None.

User interface changes

None.

API changes

Moving around of these two public API functions, they were added in D8, and are only useful for highly specialized code, so this won't affect anybody. Also: apparently a change notice for these two additions was never written (probably because they were added as part of much larger patches), so there aren't change notices to be updated, only one to be written.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
25.25 KB

Status: Needs review » Needs work

The last submitted patch, 1: filter_functions_to_filterformatinterface-2184315-1.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
25.25 KB
Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +PHPUnit

Makes total sense to not have the code in global functions but on the domain object. Looks good :)

Wim Leers’s picture

Priority: Major » Critical

Bumping to critical because this is blocking a critical: #2099741: Protect WYSIWYG Editors from XSS Without Destroying User Data.

alexpott’s picture

Title: Move filter_get_filter_types_by_format() and filter_get_html_restrictions_by_format() onto FilterFormatInterface » Change notice: Move filter_get_filter_types_by_format() and filter_get_html_restrictions_by_format() onto FilterFormatInterface
Priority: Critical » Major
Status: Reviewed & tested by the community » Active
Issue tags: +Approved API change

Committed 81e3e03 and pushed to 8.x. Thanks!

Wim Leers’s picture

Title: Change notice: Move filter_get_filter_types_by_format() and filter_get_html_restrictions_by_format() onto FilterFormatInterface » Move filter_get_filter_types_by_format() and filter_get_html_restrictions_by_format() onto FilterFormatInterface
Status: Active » Fixed

Because didn't have the change notice issue tag, I didn't notice this one needed a change notice still — sorry :(

Existing change notice updated: https://drupal.org/node/1817474.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Wim Leers’s picture

Issue tags: -sprint