(Critical because the upgrade path is broken)

Currently the filter default settings are not merged in dynamically when loading the filter itself from the database. The whole thing assumes that the default settings are stored on the database as well as in code. When upgrading a site from Drupal 6, you will see some fun notices:

Notice: Undefined index: filter_url_length in _filter_url() (line 1295 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: allowed_html in _filter_html() (line 1158 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: filter_html_nofollow in _filter_html() (line 1161 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: filter_url_length in _filter_url() (line 1295 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: allowed_html in _filter_html() (line 1158 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: filter_html_nofollow in _filter_html() (line 1161 of /shared/core/www/d7/modules/filter/filter.module).

I can see two ways forward:

  • We merge in defaults in filter_update_7004()
  • We merge in defaults dynamically in filter_list_format()... we already call filter_get_filters() there anyway, so the hard part is already done.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Title: Text format settings silliness » Filter settings silliness
Damien Tournoud’s picture

Status: Active » Needs review
FileSize
885 bytes

I think merging in at runtime is better.

chx’s picture

Status: Needs review » Needs work

You have your union backwards. We always add the default to the existing values because the right hand side does not override:

php -r "var_export(array('foo' => 'default') + array('foo' => 'specific'));"
array (
  'foo' => 'default',
)
dawehner’s picture

Status: Needs work » Needs review
FileSize
667 bytes

here is a patch

chx’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

Damien Tournoud’s picture

That's why you should never roll patches after 1am :)

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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