fix: settings compare against the sanitized value, fail via WriteFailed

- isStored() compares the stored option with sanitize_option() of the new value
  (core esc_html()s blogname/blogdescription): setting "Müller & Söhne" again
  no longer looks like a failed write; lit/wp-settings-get and previous return
  those two decoded, as the user would type them.
- The change log runs as FollowUp (warning on failure); a failed write throws
  WriteFailed (write_failed / partial_write with keys), partial writes are
  logged with result partial.
- permalink_structure needs a real %tag% (WordPress' own /%[^/%]+%/ rule).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 01:26:11 +02:00
co-authored by Claude Opus 5.5
parent d67a1d4fb3
commit ff0da9f406
4 changed files with 170 additions and 48 deletions
@@ -64,6 +64,9 @@ final class SettingsWhitelistTest extends TestCase
self::assertNull($whitelist->validate('permalink_structure', '/%postname%/', []));
self::assertNull($whitelist->validate('permalink_structure', '', []));
self::assertNotNull($whitelist->validate('permalink_structure', 'postname', []));
self::assertNull($whitelist->validate('permalink_structure', '/blog/%year%/%postname%/', []));
self::assertNotNull($whitelist->validate('permalink_structure', '/%%/', []));
self::assertNotNull($whitelist->validate('permalink_structure', '/%/', []));
self::assertNotNull($whitelist->validate('posts_per_page', 0, []));
self::assertNotNull($whitelist->validate('default_comment_status', 'maybe', []));
self::assertNull($whitelist->validate('site_icon', 33, []));