wordpress-develop/tests/phpunit/tests/option
Sergey Biryukov e834fed6eb Options, Meta APIs: Check if the gmt_offset value is numeric in sanitize_option().
When saving the settings via the admin UI, the default value for any options not passed in the current `$_POST` request is set to `null` in `wp-admin/options.php`. Some options, e.g. `blog_public`, then rely on `null` being passed to `update_option()` to determine whether the value was changed or not.

This commit resolves a PHP 8.1 deprecation notice when saving the `gmt_offset` option without any changes:
{{{
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
}}}

Includes a similar fix for the `blog_charset` option.

Follow-up to [4112], [4329], [5541], [21849].

Props adi3890, dhrupo, hrdelwar, hasanmisbah, oglekler, mukesh27, SergeyBiryukov.
Fixes #57728.

git-svn-id: https://develop.svn.wordpress.org/trunk@56132 602fd350-edb4-49c9-b593-d223f7449a82
2023-07-04 13:40:55 +00:00
..
multisite.php Networks and Sites: Revert the use of the metadata API for *_network_options functions. 2022-10-18 18:14:01 +00:00
networkOption.php Networks and Sites: Revert the use of the metadata API for *_network_options functions. 2022-10-18 18:14:01 +00:00
option.php Tests: Rename the test for pre_option filter to match the filter name. 2022-09-13 20:19:17 +00:00
registration.php Build/Test Tools: Add @covers tags to the options tests. 2022-08-08 23:33:11 +00:00
sanitizeOption.php Options, Meta APIs: Check if the gmt_offset value is numeric in sanitize_option(). 2023-07-04 13:40:55 +00:00
siteOption.php Build/Test Tools: Add @covers tags to the options tests. 2022-08-08 23:33:11 +00:00
siteTransient.php Tests: Make the message for skipping some tests with an external object cache more consistent. 2022-10-23 12:36:58 +00:00
slashes.php Build/Test Tools: Add @covers tags to the options tests. 2022-08-08 23:33:11 +00:00
themeMods.php Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/option/themeMods.php. 2023-01-19 17:07:22 +00:00
transient.php Tests: Make the message for skipping some tests with an external object cache more consistent. 2022-10-23 12:36:58 +00:00
updateOption.php Tests: Use the function get_num_queries across all unit tests. 2023-05-11 10:05:51 +00:00
userSettings.php Build/Test Tools: Add @covers tags to the options tests. 2022-08-08 23:33:11 +00:00
wpLoadAlloptions.php Tests: Use the function get_num_queries across all unit tests. 2023-05-11 10:05:51 +00:00
wpUserSettings.php Tests: Add a unit test for PHP 8.1 deprecation notice in wp_user_settings(). 2022-06-13 15:20:02 +00:00