Skip to content

Commit

Permalink
Options: Show error when updating all options exceeds max_input_vars.
Browse files Browse the repository at this point in the history
On sites with a large number of options, the number of inputs when saving all options via the /wp-admin/options.php page may exceed PHP's `max_input_vars` setting, this will prevent saving.

An error is now shown if this is the case.

Props ishitaka, jorbin, maguijo, pento, sergeybiryukov. 
Fixes #45438.

Built from https://develop.svn.wordpress.org/trunk@53151


git-svn-id: http://core.svn.wordpress.org/trunk@52740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
peterwilsoncc committed Apr 12, 2022
1 parent b53f7ce commit 5703931
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion wp-admin/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) );
}
$options = explode( ',', wp_unslash( $_POST['page_options'] ) );
$options = isset( $_POST['page_options'] ) ? explode( ',', wp_unslash( $_POST['page_options'] ) ) : null;
} else {
$options = $allowed_options[ $option_page ];
}
Expand Down Expand Up @@ -332,6 +332,8 @@
if ( $user_language_old !== $user_language_new ) {
load_default_textdomain( $user_language_new );
}
} else {
add_settings_error( 'general', 'settings_updated', __( 'Settings save failed.' ), 'error' );
}

/*
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-53150';
$wp_version = '6.0-alpha-53151';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 5703931

Please sign in to comment.