46164 Commits

Author SHA1 Message Date
Andrew Ozz
87fc70103d Build/Test Tools: Add @covers tags to the options tests.
Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53865 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-08 23:33:11 +00:00
Andrew Ozz
a3a926097a Build/Test Tools: Add @covers tags to the import tests.
Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53864 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-08 23:22:43 +00:00
Andrew Ozz
57b08d1998 Build/Test Tools: Add @covers tags to the comments tests.
Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53863 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-08 23:12:30 +00:00
Sergey Biryukov
041a9256fb Docs: Improve @since notes for some WP_Filesystem_* methods:
* `WP_Filesystem_FTPext::exists()`
* `WP_Filesystem_FTPext::size()`
* `WP_Filesystem_ftpsockets::exists()`

The `::exists()` methods were previously using the FTP `NLST` command, which works for directories, but is not intended to be applied to a file. This only worked most of the time due to many FTP servers being permissive and allowing to execute `NLST` on files, which cannot be guaranteed and appears to not be the case in newer versions of Pure-FTPd (1.0.48 or later).

With a recent change in [53860], both methods were updated for compatibility with RFC 959:

* Both methods check if the path is a directory that can be changed into (and therefore exists).
* `WP_Filesystem_FTPext` uses `ftp_rawlist()` (FTP `LIST` command) to check for file existence.
* `WP_Filesystem_ftpsockets` uses file size to check for file existence.

Reference: [https://www.ietf.org/rfc/rfc959.txt RFC 959: File Transfer Protocol (FTP)]

Follow-up to [6779], [11821], [25274], [33648], [34733], [35944], [35946], [53860].

See #51170.

git-svn-id: https://develop.svn.wordpress.org/trunk@53862 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-08 17:12:59 +00:00
Sergey Biryukov
e14d94858f Tests: Improve the test for not throwing a warning on malformed date queries.
* Make it specifically about `wp_resolve_numeric_slug_conflicts()`, the function that was throwing an `Undefined array key "year"` PHP warning for malformed date requests.
* Move the test under the `rewrite` component and make its name a bit more descriptive.
* Check the return result of the function instead of performing a dummy assertion.
* Use named array keys in the data provider for clarity.
* Add missing `@covers` tag.

Follow-up to [32648], [53857].

Props costdev, peterwilsoncc, 1naveengiri, mukesh27, SergeyBiryukov.
See #52252, #45513.

git-svn-id: https://develop.svn.wordpress.org/trunk@53861 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-08 14:38:08 +00:00
Jb Audras
374052e29a Filesystem: Rewrite FTP/FTP Sockets exists() methods to implement a more stable check.
WordPress FTP file checking was previously based upon `ftp_nlist()`. This function can be problematic at scale with a directory containing a large number of files. The same issue occurred using it with ftpsockets.

This changeset rewrites the FTP `exists()` functions to utilize a more efficient and stable check.

Props giox069, desrosj, mkox, afragen, costdev, pbiron, peterwilsoncc.
Fixes #51170.
See #53318, #39781.


git-svn-id: https://develop.svn.wordpress.org/trunk@53860 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-08 12:39:51 +00:00
Jb Audras
ba870c487b Docs: Various docblock fixes in wp-includes/blocks.php, as per docs standards.
See #55646.


git-svn-id: https://develop.svn.wordpress.org/trunk@53859 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-08 08:31:03 +00:00
Jb Audras
0e9917f561 Editor: Safeguard has_blocks() against fatal errors.
This changeset ensures `has_blocks()` doesn't return a fatal error when `$post` is not a valid post. If the post can't be retrieved, the function now returns `false`.

Props Howdy_McGee, costdev, colonelphantom, audrasjb, dlh, peterwilsoncc.
Fixes #55705.


git-svn-id: https://develop.svn.wordpress.org/trunk@53858 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-08 08:20:43 +00:00
Peter Wilson
3e866f8b8f Rewrite rules: Prevent malformed date requests throwing notices.
Ensure that date queries contain each component before attempting to use them. This prevents http requests triggering notices if a portion of the date is missing. For example a request containing a day and year but no month, a request containing a month bu not year.

Props ovidiul, dd32, peterwilsoncc, costdev, johnbillion, SergeyBiryukov, desrosj, tremidkhar, hellofromTonya.
Fixes #52252.



git-svn-id: https://develop.svn.wordpress.org/trunk@53857 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-07 23:03:57 +00:00
Sergey Biryukov
fbfba47f1a Code Modernization: Let MockClass extend stdClass.
This allows for arbitrary properties to be declared on it.

Alternatively, the `MockClass` could be deprecated altogether in favor of directly using `stdClass` where needed.

Follow-up to [53/tests], [65/tests], [53557], [53558], [53850], [53851], [53852], [53853], [53854].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53856 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-07 16:53:30 +00:00
Sergey Biryukov
025193bd20 Code Modernization: Remove unused $undefined property in Tests_WP_Customize_Manager.
This appears to be a copy/paste from the `Tests_WP_Customize_Setting` class, and is not actually used in `WP_Customize_Manager` tests.

Follow-up to [31329], [32658], [53851].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53855 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-07 16:36:42 +00:00
Sergey Biryukov
101e686f7a Code Modernization: Remove dynamic properties in Tests_File.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this case, as the `$badchars` property never changes, declaring this as a class constant is the sensible option.

As for the `$dir` property (which cannot be turned into a constant due to the function call), this is used in multiple tests, so making this property explicit makes sense.

Follow-up to [139/tests], [53557], [53558], [53850], [53851], [53852], [53853].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53854 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-07 14:48:42 +00:00
Sergey Biryukov
278081ed1d Code Modernization: Remove dynamic properties in Tests_Post_Revisions.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test class contains a `set_up()` method that sets the `$post_type` property, which is ''used'' by the tests, but never ''changed'' by the tests.

In other words, setting this property in the `set_up()` is an unnecessary overhead and the property should be changed to a class constant.

Follow-up to [1212/tests], [52389], [53557], [53558], [53850], [53851], [53852].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53853 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-07 14:41:04 +00:00
Sergey Biryukov
9d2f309e63 Code Modernization: Remove dynamic properties in Tests_Media_GetPostGalleries.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test class contains a `set_up()` method that sets the `$img_meta` property, which is ''used'' by the tests, but never ''changed'' by the tests.

In other words, setting this property in the `set_up()` is an unnecessary overhead and the property should be changed to a class constant.

Includes renaming the test class to match the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization naming conventions].

Follow-up to [52190], [53557], [53558], [53850], [53851].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53852 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-07 14:32:55 +00:00
Sergey Biryukov
8b98406a17 Code Modernization: Remove unused dynamic property in Tests_WP_Customize_*.
The dynamically created `$undefined` property appears to be a copy/paste from the `Tests_WP_Customize_Setting` class, and is not actually used in other test classes:

* `Tests_WP_Customize_Manager`
* `Tests_WP_Customize_Panel`
* `Tests_WP_Customize_Section`

Follow-up to [31329], [32658].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53851 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-07 14:20:02 +00:00
Sergey Biryukov
350d5e4590 Code Modernization: Remove dynamic properties in Tests_POMO_PO.
In this particular case, the test class contains a `set_up()` method which sets properties only used by select tests, while the fixture method is being run for all tests.

There were a few ways this could be fixed:
* As the values do not change across tests, use `set_up_before_class()` to set (static) properties instead.
* For those values which are set up without a function call or variable interpolation, set the values in class constants.
* Or set these values as local variables for those tests which actually use them.

The implemented solution is a combination of options 2 and 3.

Follow-up to [1106/tests], [53557], [53558].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53850 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-07 13:56:35 +00:00
Sergey Biryukov
d6b46b9b99 Tests: Rename the test class for wp_preload_resources() tests.
This matches the name of the function being tested.

Follow-up to [53846].

See #42438.

git-svn-id: https://develop.svn.wordpress.org/trunk@53849 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-06 00:03:01 +00:00
Adam Silverstein
3deb9e9520 Media: use original image size data for full size secondary mime generation.
Correct an issue where the secondary mime type full size image would not be properly resized (and `-scaled` added to the name) when the original upload is over the `big_image_size_threshold` dimensions.

Props mukesh27.
See #55443.




git-svn-id: https://develop.svn.wordpress.org/trunk@53848 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 22:14:09 +00:00
Adam Silverstein
2615c4dc0c Media: correct a misnamed variable when creating sub sizes with multi_resize.
Props mehulkaklotar, mukesh27.
See #55443.



git-svn-id: https://develop.svn.wordpress.org/trunk@53847 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 18:56:25 +00:00
Adam Silverstein
beabd7a8fb Script loader: enable resource preloading with rel='preload'.
Add a `wp_preload_resources` filter that developers can use to add resource preloading.

Preloading helps the browser discover and prioritize important resources earlier during the page load. This ensures that they are available earlier and are less likely to block the page's render.

Props nico23, swissspidy, igrigorik, westonruter, azaozz, furi3r, aristath, spacedmonkey, peterwilsoncc, mihai2u, gziolo. 
Fixes #42438.



git-svn-id: https://develop.svn.wordpress.org/trunk@53846 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 18:24:42 +00:00
Adam Silverstein
6b3a677ce2 Media: remove unused _wp_image_belongs_to_attachment function.
Remove the `_wp_image_belongs_to_attachment` function which was left over from a an unused branch and added inadvertently as part of r53751.

Props mukesh27.
Fixes #56333.



git-svn-id: https://develop.svn.wordpress.org/trunk@53845 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 16:10:52 +00:00
Jb Audras
39ade7e466 Plugins: Properly encode query string s parameter in plugin search.
This ensures special characters like `&` are properly encoded when passed as URL parameter.

Props praful2111, audrasjb, costdev.
Fixes #56339.


git-svn-id: https://develop.svn.wordpress.org/trunk@53844 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 14:10:03 +00:00
Jb Audras
5abf5f6b61 Docs: Various docblock fixes in wp-admin/includes/image.php class, as per docs standards.
See #55646.


git-svn-id: https://develop.svn.wordpress.org/trunk@53843 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 14:05:20 +00:00
Sergey Biryukov
cc4a86d8bf Revisions: Use wp_get_latest_revision_id_and_total_count() where appropriate.
The function executes an optimized query to get the last revision ID and total count. It was originally introduced for `WP_REST_Posts_Controller::prepare_links()`, and is now used in a few more places in core:

* `register_and_do_post_meta_boxes()`
* `wp_get_post_revisions_url()`
* `wp_update_custom_css_post()`

Follow-up to [53759], [53769], [53778], [53779], [53841].

Props peterwilsoncc, mukesh27, SergeyBiryukov.
Fixes #56279.

git-svn-id: https://develop.svn.wordpress.org/trunk@53842 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 13:37:47 +00:00
Sergey Biryukov
81805856e2 Revisions: Use latest_id as the array key for the latest revision ID.
This updates `wp_get_latest_revision_id_and_total_count()` and its usage to be a bit more descriptive and a bit less repetitive, e.g. `$revisions['latest_id']` instead of `$revision['revision']`.

Includes updating the `@return` tag to explain when the function returns a `WP_Error`.

Follow-up to [53759], [53769], [53778], [53779].

See #55857.

git-svn-id: https://develop.svn.wordpress.org/trunk@53841 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 13:00:57 +00:00
Jb Audras
60284ca751 Coding standards: Properly escape URLs returned by self_admin_url() calls.
This address some other echoed instances missed by [53839].

Fixes #56329.


git-svn-id: https://develop.svn.wordpress.org/trunk@53840 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 06:10:04 +00:00
Jb Audras
ad03949f7b Coding standards: Properly escape URLs returned by self_admin_url() calls.
Props krishaweb, audrasjb, SergeyBiryukov.
Fixes #56329.


git-svn-id: https://develop.svn.wordpress.org/trunk@53839 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 05:58:01 +00:00
Peter Wilson
b96a51c529 Sitemaps: Prevent invalid provider names throwing errors.
Validate the requested sitemap is a string before attempting to use it in a provider. This prevents `WP_Sitemaps_Registry::get_provider()` from triggering a fatal error in more recent versions of PHP.

The errors can be triggered by items outside the site owner or developers control (such as a user visiting `?sitemap[foo]=bar`) so the code fails silently to avoid filling error logs with unfixable errors.

Props costdev, dd32.
Fixes #56336.


git-svn-id: https://develop.svn.wordpress.org/trunk@53838 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 05:47:56 +00:00
Jb Audras
193444426a Docs: Provide a more accurate @return type for get_pages() function.
Props malthert, audrasjb, johnbillion, jigar-bhanushali.
Fixes #56330.
See #55646.


git-svn-id: https://develop.svn.wordpress.org/trunk@53837 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-05 05:44:49 +00:00
Sergey Biryukov
02c5d3a964 Tests: Combine test classes for get_edit_term_link() tests.
There were two sets of tests for the function:
* One in the `link` directory, based on the `link-template.php` file name.
* One in the `term` directory, based on the component name.

To avoid confusion and make it easier to decide where new tests should go in the future, the existing tests are now combined in the former location.

Includes:
* Setting the current user in `::set_up()` instead of each individual test method.
* Changing the custom taxonomy name to `wptests_tax` for consistency with other tests.
* Moving `::register_custom_taxonomy()` and `::get_term()` helpers to the beginning of the class.

Follow-up to [32954], [36646], [52180], [52255], [53833].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53836 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 18:28:33 +00:00
Sergey Biryukov
2c305659d3 Tests: Use named data provider for WP_Object_Cache::is_valid_key() test.
This makes the output when using the `--testdox` option more descriptive and is helpful when trying to debug which data set from a data provider failed the test.

Follow-up to [53818], [53821], [53822], [53834].

See #56198.

git-svn-id: https://develop.svn.wordpress.org/trunk@53835 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 17:47:41 +00:00
Sergey Biryukov
74c8b7f2de Tests: Add more test cases for WP_Object_Cache::is_valid_key().
A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string. To avoid potential compatibility issues or key collisions, a string that becomes empty after `trim()` should not be considered a valid cache key.

Follow-up to [53818], [53821], [53822].

Props tillkruess.
See #56198.

git-svn-id: https://develop.svn.wordpress.org/trunk@53834 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 17:31:45 +00:00
Sergey Biryukov
d1b3e1cfd4 Tests: Correct data providers for get_term_link() and get_edit_term_link() tests.
* The tests use named data providers which include a flag for passing either a term ID or term object to the test, but the values for the flag were the opposite of what the array key says.
* Some array keys were duplicated, which means the earlier test case with the same name did not actually run.

Follow-up to [52180], [52255], [52258], [52305].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53833 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 17:18:36 +00:00
Sergey Biryukov
13e076e6a4 Coding Standards: Reorder global cache groups alphabetically for some consistency.
Follow-up to [53823], [53824].

See #55647.

git-svn-id: https://develop.svn.wordpress.org/trunk@53832 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 16:27:02 +00:00
Sergey Biryukov
87fc33105c Docs: Remove obsolete comment in object cache tests.
The comment mentioned creating two cache objects with a shared cache directory, which was no longer the case.

Follow-up to [5/tests] [170/tests].

See #55646, #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53831 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 15:49:23 +00:00
Sergey Biryukov
15b2748615 Tests: Move wp_cache_replace() test to a more appropriate place.
This matches the location of other `wp_cache_*()` tests following the respective `WP_Object_Cache` method tests.

Follow-up to [1275/tests].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53830 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 15:42:57 +00:00
Sergey Biryukov
54106e0359 Tests: Remove the list of non-persistent groups in Memcached implementation used in the test suite.
This list was not up to date, and does not appear to be required, as `WP_UnitTestCase_Base::flush_cache()` adds the correct list of groups, which is up to date.

Follow-up to [1332/tests], [8068], [37613], [40561], [52976], [53826], [53828].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53829 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 15:37:15 +00:00
Sergey Biryukov
0a35283aa3 Tests: Make the comment cache group persistent in WP_UnitTestCase_Base::flush_cache().
This brings the list of persistent groups when running the test suite in line with core.

Follow-up to [1332/tests], [37613], [52976].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53828 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 15:16:32 +00:00
John Blackbourn
c47f438376 Docs: Various corrections and improvements to inline documentation.
See #55646


git-svn-id: https://develop.svn.wordpress.org/trunk@53827 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 14:50:27 +00:00
Sergey Biryukov
bd6f081030 Tests: Remove the list of global groups in Memcached implementation used in the test suite.
This list was not up to date, and does not appear to be required, as `WP_UnitTestCase_Base::flush_cache()` adds the correct list of groups, which is up to date.

Follow-up to [1332/tests], [40343], [40561], [53823], [53824].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53826 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 14:46:11 +00:00
Jonathan Desrosiers
e9fa9a56a8 Posts, Post Types: Change variable name in wp_set_post_terms() for clarity.
This changes the `$tags` variable used within `wp_set_post_terms()` to `$terms`.

While the default for the `$taxonomy` argument is `post_tag`, the function can be used to assign terms to a post for any taxonomy. When a different taxonomy is passed, `$tags` is an inaccurate name and could be confusing.

Props hilayt24, costdev, SergeyBiryukov, krishaweb, desrosj.
Fixes #56331.

git-svn-id: https://develop.svn.wordpress.org/trunk@53825 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 14:07:28 +00:00
Sergey Biryukov
2fc936733e Tests: Simplify the list of global groups in object cache tests.
This list was not up to date due to missing `blog_meta` group, and does not appear to be required for the tests to pass, as `WP_UnitTestCase_Base::flush_cache()` adds the same list of groups, which is up to date.

Follow-up to [946/tests], [1332/tests], [40343], [42836], [53823].

See #55647.

git-svn-id: https://develop.svn.wordpress.org/trunk@53824 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 14:02:36 +00:00
Sergey Biryukov
183bfc8b25 Coding Standards: Wrap long lines with global cache groups for better readability.
Follow-up to [946/tests], [1060/tests], [https://mu.trac.wordpress.org/changeset/1784 mu1784], [https://mu.trac.wordpress.org/changeset/2032 mu2032] [https://mu.trac.wordpress.org/changeset/2029 mu2029], [7986], [12128], [12603], [12688], [12732], [12755], [13125], [14009], [15482], [21403], [22092], [31347], [31348], [36258], [36393], [36413], [37918], [40343], [40347], [42836].

See #55647.

git-svn-id: https://develop.svn.wordpress.org/trunk@53823 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 13:31:19 +00:00
Sergey Biryukov
dc0672616c Tests: Add a test case with a float value for WP_Object_Cache::is_valid_key().
A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string. To avoid potential compatibility issues or key collisions, float values should not be considered a valid cache key.

Follow-up to [53818], [53821].

Props tillkruess, malthert, spacedmonkey.
See #56198.

git-svn-id: https://develop.svn.wordpress.org/trunk@53822 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 12:35:28 +00:00
Sergey Biryukov
a164d64275 Tests: Add a unit test for WP_Object_Cache::is_valid_key().
A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string.

Follow-up to [53818].

See #56198.

git-svn-id: https://develop.svn.wordpress.org/trunk@53821 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-04 12:09:03 +00:00
Jb Audras
e6f7520266 Twenty Eleven: Remove a useless CSS comment after [53819].
This comment does not apply anymore. Follow-up to [53819].

See #56297.


git-svn-id: https://develop.svn.wordpress.org/trunk@53820 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-03 17:15:04 +00:00
Jb Audras
1aa576b2a0 Twenty Eleven: Use more specific CSS selectors for .required styles.
This changeset adds more specific CSS selectors so third-parties fields are not targeted by the related CSS rules.

Props umesh84, sabernhardt, costdev.
Fixes #56297.


git-svn-id: https://develop.svn.wordpress.org/trunk@53819 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-03 17:10:03 +00:00
Sergey Biryukov
ad93e6387c Cache API: Validate cache key in WP_Object_Cache methods.
Some plugins may call the `wp_cache_*()` functions with an empty string, `false`, or `null` as cache key, usually as a result of not checking the return value of another function that's used as the key.

Previously, this was silently failing, leading to odd behavior at best and often breakage due to key collisions.

A valid cache key must be either an integer number or a non-empty string.

This commit introduces a quick type check on the given cache keys and adds a `_doing_it_wrong()` message that should help plugin developers to notice these issues quicker.

Includes:
* A check in `update_user_caches()` and `clean_user_cache()` to make sure user email is not empty before being cached or removed from cache, as it is technically possible to create a user with empty email via `wp_insert_user()`.
* Some minor cleanup in unit tests where the email was passed to `wp_insert_user()` incorrectly or was unintentionally reset.

Props tillkruess, malthert, dd32, spacedmonkey, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #56198.

git-svn-id: https://develop.svn.wordpress.org/trunk@53818 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-03 14:34:58 +00:00
Sergey Biryukov
ec70b4caee Coding Standards: Remove extra space in two conditionals.
This fixes WPCS errors in `WP_Site_Health::get_test_plugin_version()` and `::get_test_theme_version()`:

* `Expected exactly one space between closing parenthesis and opening control structure; " " found.`
* `Expected 1 space(s) after closing parenthesis; found 2`

Follow-up to [53816].

See #56134.

git-svn-id: https://develop.svn.wordpress.org/trunk@53817 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-03 14:30:34 +00:00
Sergey Biryukov
4def4f82a2 Site Health: Improve the wording in plugin and theme version tests.
This displays a more appropriate message in case the site does not have any active plugins or installed themes.

Follow-up to [44986], [45099], [45336].

Props Presskopp, costdev, martin.krcho, Clorith, SergeyBiryukov.
Fixes #56134.

git-svn-id: https://develop.svn.wordpress.org/trunk@53816 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-03 13:07:05 +00:00