Repository navigation
Conversation
…POST field names. On Settings -> All Settings (`wp-admin/options.php`), PHP converts dots, spaces, and open square brackets in submitted form field names to underscores (or parses brackets as arrays), and `page_options` is comma-delimited. Because those option names were still added to `page_options`, saving the form looked up an absent key in `$_POST` and called `update_option( $option, null )`, wiping existing values (such as dotted plugin options like `litespeed.conf.*`). In addition, `home` and `siteurl` were marked disabled when `WP_HOME` or `WP_SITEURL` were defined, yet were still added to `page_options`, causing spurious invalid URL errors on save. Extract field preparation into `_wp_prepare_all_options_field()`, mark options whose names contain characters rewritten by PHP or the `page_options` comma delimiter as disabled, only append non-disabled options to `$options_to_update`, and apply `disabled()` to `<textarea>` fields as well as `<input>` fields. Trac ticket: https://core.trac.wordpress.org/ticket/66864 See also: https://core.trac.wordpress.org/ticket/66863
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
❌ PHPStan Static AnalysisPHPStan reported 1 error when analyzing 8ca783f (workflow run). This comment is updated as new commits are pushed. Important The PHPStan baselines are out of date, so the PHPStan check fails. An error recorded in a baseline no longer occurs, or occurs a different number of times. If this pull request fixed it, that is expected: nothing needs to change in the code, but each baseline entry records an exact count for a specific file, and the baselines need to catch up. Remove the stale entries, and commit the result: npm run typecheck:php:fixor, outside the Docker environment: composer phpstan:fixThis also deletes any baseline left with no entries, and removes any See Removing stale entries with Errors that fail the check
Running PHPStan locallyTo run the analysis on your own machine, use |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/66864
See also: https://core.trac.wordpress.org/ticket/66863
Description
On Settings → All Settings (
wp-admin/options.php), PHP converts dots (.), spaces, and open square brackets ([) in submitted form field names to underscores (or parses brackets as arrays), andpage_optionsis comma-delimited. Because options containing these characters were still listed inpage_options, clicking Save Changes looked up an absent key in$_POSTand calledupdate_option( $option, null ), wiping their stored values (such as dotted plugin options likelitespeed.conf.*).Additionally,
homeandsiteurlwere marked$disabled = truewhenWP_HOME/WP_SITEURLwere defined, yet were still appended to$options_to_update, causing spurious"did not appear to be a valid URL"errors on every save (#66863).Changes
_wp_prepare_all_options_field()insrc/wp-admin/includes/options.php./[\s.\[,]/as disabled while preserving their display value.$options_to_update = array()and only append non-disabled options (if ( ! $disabled )) topage_options, which also resolves #66863.disabled( $disabled, true )to<textarea>elements insrc/wp-admin/options.php(previously only<input>had it).tests/phpunit/tests/admin/wpPrepareAllOptionsField.php.Testing
vendor/bin/phpcson all modified and new files.tests/phpunit/tests/admin/wpPrepareAllOptionsField.php(16 tests, 32 assertions).