- `__construct()` gets the new `_deprecated_class()` function
- `WP_User_Search` PHP4 style constructor is changed from `_deprecated_function()` to `_deprecated_constructor()`
Adds a test to confirm `WP_User_Search` class is testable as deprecated.
Props jrf, DrewAPicture.
Fixes#41125.
Built from https://develop.svn.wordpress.org/trunk@56469
git-svn-id: http://core.svn.wordpress.org/trunk@55981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Similar to other function in the `_deprecated_*` series, `_deprecated_class()` comes with two new hooks: `deprecated_class_run` and `deprecated_class_trigger_error`.
Support has also been added for setting class deprecation expectations in tests.
Props jrf, wvega, ohryan.
See #41125.
Built from https://develop.svn.wordpress.org/trunk@56467
git-svn-id: http://core.svn.wordpress.org/trunk@55979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
By default, Docker waits for a container to be started before considering it “ready”. But this does not necessarily mean that it’s ready to receive commands.
This adds a check that ensures the database container is ready to receive commands before proceeding with running commands.
Follow up to [56439], [56440], [56443].
Props rmccue, desrosj.
See #30462, #58867.
Built from https://develop.svn.wordpress.org/trunk@56464
git-svn-id: http://core.svn.wordpress.org/trunk@55976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fix an issue where the `X-Robots` header was used instead of the `X-Robots-Tag` header. Using `X-Robots-Tag` yields the correct behavior that the original code intended to add. `X-Robots` is left in place for backward compatibility.
Props michelleblanchette, dhruvishah2203, rajinsharwar, jorbin, hztyfoon, elrae.
Fixes#58865.
Built from https://develop.svn.wordpress.org/trunk@56462
git-svn-id: http://core.svn.wordpress.org/trunk@55974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change the 'x' in the Help message that instructs a user how to remove an item from a group of bulk edit items to use the dashicon and text equivalent that matches the visual and accessible control name.
Props Presskopp, costdev, sabernhardt, matthewfarlymn, bvreeman22.
Fixes#58785.
Built from https://develop.svn.wordpress.org/trunk@56460
git-svn-id: http://core.svn.wordpress.org/trunk@55972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In r56093 schema caching was added above a comment instructing developers not to cache that controller's schema. However, there is no obvious penalty for re-caching schema that is partially derived from a parent.
Caching schema in the same way in every controller is beneficial consistency, and discussion at WCUS2023 contributor day concluded we could remove this comment.
Props ahardyjpl, davidbinda, johnjamesjacoby, TimothyBlynJacobs.
Fixes#59193. See #58657.
Built from https://develop.svn.wordpress.org/trunk@56459
git-svn-id: http://core.svn.wordpress.org/trunk@55971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Some block themes like TT3 use `wp_get_block_css_selector` to determine a CSS selector based on block type and other parameters. However, recent performance profiling indicated a bottleneck in `wp_get_block_css_selector`, particularly sections that utilize `array_merge`. By slightly refactoring these sections, `array_merge` calls can be avoided which increases performance.
Props mukesh27, joemcgill, daxelrod, tabrisrp.
Fixes#59178.
Built from https://develop.svn.wordpress.org/trunk@56457
git-svn-id: http://core.svn.wordpress.org/trunk@55969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, in `register_block_script_handle()` the `$script_uri` variable initialized with a `plugins_url()` call that was reported to invoke four times. In this patch the var is initialized as a blank string with a fallback to use the `plugins_url()` if the other intended conditions are not met.
Props mukesh27, daxelrod, adamsilverstein, davidbaumwald.
Fixes#59181.
Built from https://develop.svn.wordpress.org/trunk@56455
git-svn-id: http://core.svn.wordpress.org/trunk@55967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds new tests to ensure that `wp_authenticate_email_password`, `wp_authenticate_username_password`, and `wp_authenticate_cookie` are better tested. This also unsets cookies properly between tests.
Props JordanPak, johnregan3.
Fixes#36476.
Built from https://develop.svn.wordpress.org/trunk@56454
git-svn-id: http://core.svn.wordpress.org/trunk@55966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that the `rewrite_rules` option is not emptied until the new value has been recalculated and the option is updated. The logic for refreshing the option value is moved to a new private method named `WP_Rewrite::refresh_rewrite_rules` which is used by both the `flush_rules` and `refresh_rewrite_rules` methods.
Props iCaleb, joemcgill, flixos90, mukesh27.
Fixes#58998.
Built from https://develop.svn.wordpress.org/trunk@56448
git-svn-id: http://core.svn.wordpress.org/trunk@55960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Set the default width and height attributes of the SVG social icons to match the dimensions used within the CSS. This increases the attributes to 32px x 32 px.
Props crunnells, mukesh27, laurelfulford, tahmidulkarim, jordanpak.
Fixes#45950.
Built from https://develop.svn.wordpress.org/trunk@56447
git-svn-id: http://core.svn.wordpress.org/trunk@55959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
WordPress's `get_option()` function generally relies on making individual database requests for each option, however with the majority of options (in most cases) being autoloaded, i.e. fetched once with a single database request and then stored in (memory) cache.
As part of a greater effort to reduce the amount of options that are unnecessarily autoloaded, this changeset introduces an alternative way to retrieve multiple options in a performant manner, with a single database request. This provides a reasonable alternative for e.g. plugins that use several options which only need to be loaded in a few specific screens.
Specifically, this changeset introduces the following functions:
* `prime_options( $options )` is the foundation to load multiple specific options with a single database request. Only options that aren't already cached (in `alloptions` or an individual cache) are retrieved from the database.
* `prime_options_by_group( $option_group )` is a convenience wrapper function for the above which allows to prime all options of a specific option group (as configured via `register_setting()`).
* `get_options( $options )` is another wrapper function which first primes the requested options and then returns them in an associative array, calling `get_option()` for each of them.
Props mukesh27, joemcgill, costdev, olliejones.
Fixes#58962.
Built from https://develop.svn.wordpress.org/trunk@56445
git-svn-id: http://core.svn.wordpress.org/trunk@55957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Removes the foreach loops from the tests by moving the in-test data sets into data providers and combines the URL data sets into one data provider to test with one test method. By using a data providor, all the tests run rather than stopping at the first failure in this group.
Fixes#57660.
Props hellofromTonya.
Built from https://develop.svn.wordpress.org/trunk@56444
git-svn-id: http://core.svn.wordpress.org/trunk@55956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This modifies the PHPUnit workflow to add MySQL version 8.0 to the strategy matrix. It also adds an additional strategy matrix to expand testing to include several supported MariaDB versions.
To prevent repeating code, the business logic of the PHPUnit testing has been moved to a new, callable workflow.
Because callable workflows target a specific branch, branches created in the future will continue to benefit from improvements made to the workflow in `trunk` without requiring backports. If a breaking change is required, older branches will need to be updated to target the commit SHA representing the final commit of the previous state.
Props johnbillion, pento, boonebgorges, netweb, nacin, desrosj.
Fixes#30462.
Built from https://develop.svn.wordpress.org/trunk@56439
git-svn-id: http://core.svn.wordpress.org/trunk@55951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As part of a previous change to add support for post type templates, the `$wp_query->get_queried_object_id()` method ended up being called twice, in both the `is_singular()` and `is_page()` conditional branches.
The `get_post()` function call was also unnecessary, as `$wp_query->get_queried_object()` is already called in the `is_singular()` branch above, which includes the `is_page()` branch too.
This commit removes the redundant calls. The first `$wp_query->get_queried_object_id()` call is removed as well, since the post ID is already available via `$wp_query->get_queried_object()`.
Follow-up to [10485], [10877], [12877], [13032], [21597], [38951].
Props mattkeys, spacedmonkey, oglekler.
Fixes#43661.
Built from https://develop.svn.wordpress.org/trunk@56424
git-svn-id: http://core.svn.wordpress.org/trunk@55936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes the error handling for when `WP_Classic_To_Block_Menu_Converter::convert()` returns an instance of `WP_Error`. `WP_Navigation_Fallback::create_classic_menu_fallback()` now checks for `is_wp_error()` and if `true`, returns the error. And the `@return` type is updated to `string|WP_Error`.
Also includes a fix in the return type in `WP_Classic_To_Block_Menu_Converter::convert()` to return an empty string instead of an array instead, i.e. when bailing out for no menu items returned by `wp_get_nav_menu_items()`. The return type is clearly documented as a `string`.
Follow-up to [56052].
Props dlh, get_dave, antonvlasenko, hellofromTonya.
Fixes#58823.
Built from https://develop.svn.wordpress.org/trunk@56422
git-svn-id: http://core.svn.wordpress.org/trunk@55934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[https://github.com/sebastianbergmann/phpunit/blob/9.6/ChangeLog-9.6.md#961---2023-02-03 PHPUnit 9.6.1] deprecated the `assertObjectHasAttribute()` and `assertObjectNotHasAttribute()` methods, leading to deprecation notices in a number of tests.
[https://github.com/sebastianbergmann/phpunit/blob/10.1.3/ChangeLog-10.1.md#1010---2023-04-14 PHPUnit 10.1.0] brought the methods back by popular request, though renamed as `assertObjectHasProperty()` and `assertObjectNotHasProperty()`, to prevent confusion with PHP 8.0 attributes.
This meant that users which cannot (yet) upgrade to PHPUnit 10.1+ would always have deprecation notices for these methods without recourse. So, after much discussion, the new methods have been backported to [https://github.com/sebastianbergmann/phpunit/blob/9.6/ChangeLog-9.6.md#9611---2023-08-19 PHPUnit 9.6.11], leaving just the 10.0.x series with a deprecation notice and no recourse.
What does this mean for WordPress?
WordPress uses the [https://github.com/Yoast/PHPUnit-Polyfills PHPUnit Polyfills] to be able to write tests for the most recent versions of PHPUnit, with the Polyfills taking care of polyfilling any new PHPUnit methods on older PHPUnit versions.
* The PHPUnit Polyfills 1.x series supports PHPUnit 4.x to 9.x.
* The PHPUnit Polyfills 2.x series supports PHPUnit 5.x to 10.x.
WordPress currently runs against PHPUnit 6.x to 9.x with PHPUnit Polyfills 1.x, while the new methods were previously only included in PHPUnit Polyfills 2.0.0+, as they were introduced in PHPUnit 10.x.
Since the `assertObjectHasProperty()` and `assertObjectNotHasProperty()` methods have been backported to PHPUnit 9.x, the PHPUnit Polyfills will now include these methods in the 1.x series as well.
By upgrading to the latest [https://github.com/Yoast/PHPUnit-Polyfills/releases/tag/1.1.0 PHPUnit Polyfills 1.1.0] release, we can get rid of the deprecation notices related to the use of the `assertObjectHasAttribute()` and `assertObjectNotHasAttribute()` methods.
This could have implications for plugins or themes running integration tests with WordPress if they have set their PHPUnit Polyfills dependency to a fixed version or have a too strict version constraint (limiting the PHPUnit Polyfills to the 1.0.x series). The solution for those plugins or themes is to update their version constraints for the PHPUnit Polyfills to allow for the 1.1.x series.
Follow-up to [51559], [51598].
Props jrf, ayeshrajans.
Fixes#59150.
Built from https://develop.svn.wordpress.org/trunk@56421
git-svn-id: http://core.svn.wordpress.org/trunk@55933 1a063a9b-81f0-0310-95a4-ce76da25c4cd