Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21507 closed task (blessed) (fixed)

Hide charset setting for new installs

Reported by: nacin's profile nacin Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Charset Keywords: has-patch
Focuses: Cc:

Description

If your site is set to UTF-8, we should hide the blog_charset setting field. There is no reason to change it away from UTF-8, and doing so can break your content and possibly make your site insecure.

This won't prevent it from changing via options.php — just hiding the primary UI.

We need to keep in mind that "UTF-8" comes in a few forms, both with and without hyphens (also, case insensitivity). We will need to check those.

Technically, this means we've removed an option from WordPress, so I reserve the right to add back one. :-)

Attachments (3)

21507.patch (2.0 KB) - added by SergeyBiryukov 12 years ago.
21507.2.patch (1.6 KB) - added by SergeyBiryukov 12 years ago.
With PHPDocs
21507.diff (2.7 KB) - added by nacin 12 years ago.

Download all attachments as: .zip

Change History (9)

#1 @nacin
12 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [21467]:

Hide the charset setting for installs that have a charset of UTF-8 already. fixes #21507.

#2 @SergeyBiryukov
12 years ago

  • Keywords has-patch added
  • Resolution fixed deleted
  • Status changed from closed to reopened

[21467] introduced a bug: if you go to Reading Settings and click Save Changes, the charset gets overwritten with an empty string in wp-admin/options.php (since it's still in $whitelist_options):
http://core.trac.wordpress.org/browser/tags/3.4.1/wp-admin/options.php#L137

As far as I can see, there's no way to output arbitrary hidden fields using the Settings API.

21507.patch moves the check to the beginning of the form and adds hidden blog_charset field right after settings_fields() if the charset is UTF-8.

#3 @nacin
12 years ago

In [21539]:

Output a hidden input of blog_charset when we are hiding the option. props SergeyBiryukov. see #21507.

@SergeyBiryukov
12 years ago

With PHPDocs

#4 @nacin
12 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In [21653]:

Remove reference to blog_charset option in Settings > Reading help. fixes #21507.

@nacin
12 years ago

#5 @nacin
12 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I think I'd rather avoid the hidden input with 21507.diff.

This also protects the option from being changed in multisite (as well it should be), forcing any single-site changes to go through options.php.

#6 @nacin
12 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In [21842]:

Avoid the need for a hidden input when suppressing the blog_charset option. fixes #21507.

Note: See TracTickets for help on using tickets.