In `WP_Theme_JSON::get_valid_block_style_variations()`, the method was calling `self::get_blocks_metadata()` even though the metadata was already retrieved in the parent function. This update reuses the existing block metadata instead of calling it again.
A new optional parameter, `$blocks_metadata`, has been added to the function, allowing it to use pre-fetched metadata when available, improving efficiency.
Fewer `self::get_blocks_metadata()` calls mean faster processing, especially in themes with many blocks.
Props mukesh27, ramonopoly, aaronrobertshaw, flixos90.
Fixes #62291.
Built from https://develop.svn.wordpress.org/trunk@59359
git-svn-id: http://core.svn.wordpress.org/trunk@58745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This resolves an issue where the private property `WP_User_Query::$results` is accessed directly in `WP_REST_Users_Controller::get_items()` instead of via the `::get_results()` method.
Follow-up to [38832].
Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59357
git-svn-id: http://core.svn.wordpress.org/trunk@58743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This adds documentation for how to generate code coverage reports to the README.md file.
`test:coverage` has also been added as an npm script to make it easier to generate a report using the local Docker environment. The script will generate an HTML, PHP, and text report file.
Props pbearne, hellofromTonya, netweb.
Fixes#53414.
Built from https://develop.svn.wordpress.org/trunk@59356
git-svn-id: http://core.svn.wordpress.org/trunk@58742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[59287] updated the test coverage workflow to make use of the reusable PHPUnit workflow logic to prevent having duplicate code. The workflow should be run when the reusable file is updated to confirm any changes made work as expected.
See #62221.
Built from https://develop.svn.wordpress.org/trunk@59355
git-svn-id: http://core.svn.wordpress.org/trunk@58741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes an issue with the usage of the new `$wp_styles->get_etag()` method in `wp-admin/load-styles.php`, where `$wp_version` is passed as the first argument instead of `$load` being used as the ''only'' argument.
Follow-up to [58935].
Props justlevine, mukesh27, swissspidy.
See #52217, #61485.
Built from https://develop.svn.wordpress.org/trunk@59341
git-svn-id: http://core.svn.wordpress.org/trunk@58727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit corrects several instances of `test_*()` methods potentially returning `void` instead of their documented return types.
Since these methods are public, `null` is used to represent a passed test for backward compatibility with the coercion of the previously-returned `void`. Previous usage of `false` is preserved.
Includes updating some `@return` tags for clarity.
Follow-up to [44986], [46276], [49927].
Props justlevine, apermo, SergeyBiryukov.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59340
git-svn-id: http://core.svn.wordpress.org/trunk@58726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit affects `WP_Theme_JSON_Resolver::resolve_theme_file_uris()`.
When setting resolved URIs in an incoming theme json object, this commit removes the unnecessary call to `WP_Theme_JSON->merge()`.
Why? `WP_Theme_JSON_Resolver::resolve_theme_file_uris()` only needs to set values for paths in the raw theme json object. It can then return a new theme object based on the updated JSON source. There's no need for a full and possibly expensive merge.
Follow-up to [61588].
Props ramonopoly, aaronrobertshaw, andrewserong.
Fixes #62329.
Built from https://develop.svn.wordpress.org/trunk@59338
git-svn-id: http://core.svn.wordpress.org/trunk@58724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit fixes an issue where some magic `__isset()` methods were potentially returning `void` (if the prop is not in an allow-listed array of fields) instead of an explicit boolean `false`.
Addressed methods:
* `WP_Comment::__isset()`
* `WP_Query::__isset()`
Follow-up to [28523], [31151], [34583], [34599].
Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59337
git-svn-id: http://core.svn.wordpress.org/trunk@58723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit adds missing `void` return types to (parent) methods that can ''explicitly'' return `void` as one of their conditional paths.
Addressed methods:
* `WP_Privacy_Requests_Table::column_status()`
* `WP_Recovery_Mode::handle_error()`
* `WP_Widget::form()` — unlike the others, it's the ''child'' classes that return `void` when the method is correctly implemented.
Note: `@return void` (where `void` is the single type returned) should not be used outside the default bundled themes and the PHP compatibility shims included in WordPress Core, as per the [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/ documentation standards].
Follow-up to [30382], [42967], [43256], [44973], [45448].
Props justlevine.
See #52217, #62281.
Built from https://develop.svn.wordpress.org/trunk@59336
git-svn-id: http://core.svn.wordpress.org/trunk@58722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit fixes an omission in the logic of `WP_Theme_JSON::merge()` where top-level background image style objects are not replaced, rather they are merged. Because background images are self contained objects, their properties are unique and should not be merged. Blocks are already catered for via `WP_Theme_JSON::get_block_nodes()`.
Follow-up to [61858].
Props ramonopoly, andrewserong.
Fixes #62328.
Built from https://develop.svn.wordpress.org/trunk@59335
git-svn-id: http://core.svn.wordpress.org/trunk@58721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Reverts an earlier change to the test suite in which the PHPUnit tests could not run if the importer plugin was not available.
This update allows the test suite to run and will fail importer tests if the plugin is not available.
Follow up to r59085.
Props peterwilsoncc, azaozz.
See #62325.
Built from https://develop.svn.wordpress.org/trunk@59326
git-svn-id: http://core.svn.wordpress.org/trunk@58712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The previous approach of running `wp_allow_comment()` twice could have unintended consequences, e.g. the `check_comment_flood` action was also triggered twice, which might lead to false-positive identification of comment flood in case there is some custom callback hooked to it, which is not expecting identical data seeing twice.
This commit introduces a new function, `wp_check_comment_data()`, to specifically check for disallowed content before and after comment data is filtered.
Follow-up to [59267].
Props david.binda, SergeyBiryukov.
See #61827.
Built from https://develop.svn.wordpress.org/trunk@59319
git-svn-id: http://core.svn.wordpress.org/trunk@58705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit fixes a regression whereby requests to global styles endpoints were not being preloaded, resulting in several requests being fired clientside unnecessarily.
For performance reasons, we preload the requests so that the data is in the editor store and ready to use straight away.
The outcome is that the editor loads more quickly.
Follow-up to [62042].
Props ellatrix, ramonopoly, apermo, peterwilsoncc.
Fixes #62315.
Built from https://develop.svn.wordpress.org/trunk@59316
git-svn-id: http://core.svn.wordpress.org/trunk@58702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This resolves a "passing null to non-nullable" deprecation notice on PHP 8.1+:
{{{
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated
}}}
Follow-up to [50129], [54477].
Props afragen, peterwilsoncc, SergeyBiryukov.
Fixes#62298.
Built from https://develop.svn.wordpress.org/trunk@59312
git-svn-id: http://core.svn.wordpress.org/trunk@58698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes a typo in the a11y helper text explaining how to navigate revisions. "Change revision by using the left and arrow keys" becomes "Change revision by using the left and right arrow keys".
Follow up to [59225].
Props pedromendonca, sabernhardt, fierevere, swissspidy.
Fixes#62306.
Built from https://develop.svn.wordpress.org/trunk@59306
git-svn-id: http://core.svn.wordpress.org/trunk@58692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The previous domain that was used to test for a host whose IPv4 address cannot be resolved, `exampleeeee.com`, got registered and has an A-record now, so it's not invalid anymore.
`.invalid` is intended for use in online construction of domain names that are sure to be invalid and which it is obvious at a glance are invalid.
Reference: [https://datatracker.ietf.org/doc/html/rfc2606#section-2 Reserved Top Level DNS Names: TLDs for Testing, & Documentation Examples].
Follow-up to [52084], [58384], [58388].
Props sippis, johnbillion, MattyRob, swissspidy.
Fixes#62303.
Built from https://develop.svn.wordpress.org/trunk@59293
git-svn-id: http://core.svn.wordpress.org/trunk@58685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds instructions to the Twenty Twenty-Two readme file for updating the comment block from the legacy version to the newer version introduced in WordPress 6.1.
As Twenty Twenty-Two supports WordPress version prior to 6.1, the legacy comment block is used by default.
Props desrosj, jeffpaul, joedolson, mikachan, mrfoxtalbot, mukesh27, poena, ryokuhi, sabernhardt, thrijith.
Fixes#56496.
Built from https://develop.svn.wordpress.org/trunk@59289
git-svn-id: http://core.svn.wordpress.org/trunk@58681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to avoid hanging PHP processes if a plugin inadvertently attempts to request a large number of revision diffs.
Follow-up to [24520], [24707], [59039].
Props madpeter, lovesoni1999, debarghyabanerjee, pbearne, desrosj, SergeyBiryukov.
Fixes#49291.
Built from https://develop.svn.wordpress.org/trunk@59288
git-svn-id: http://core.svn.wordpress.org/trunk@58680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the Test Coverage workflow to make use of the reusable PHPUnit test workflow to avoid having duplicate code.
`concurrency` has also been configured for the workflow, and 4 test jobs have been consolidated into 2.
Props jrf.
Fixes#62296.
Built from https://develop.svn.wordpress.org/trunk@59287
git-svn-id: http://core.svn.wordpress.org/trunk@58679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Break out logic from the `next_token()` method into a private method which may call itself recursively. This allows for subclasses to override the `next_token()` method and be assured that each call to `next_token()` corresponds with the consumption of one single token. This also parallels how `WP_HTML_Tag_Processor::next_token()` wraps a private `base_class_next_token()` method.
Props westonruter, jonsurrell.
Fixes#62269.
Built from https://develop.svn.wordpress.org/trunk@59285
git-svn-id: http://core.svn.wordpress.org/trunk@58677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
GitHub Actions caps the number of jobs that can be spawned from a single matrix at 256.
The changes in [59280] pushed the WordPress 6.x job over this limit. This splits that matrix into two following established pattern for older branches in the workflow.
See #61218, #62221.
Built from https://develop.svn.wordpress.org/trunk@59281
git-svn-id: http://core.svn.wordpress.org/trunk@58673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Because `caching_sha2_password` is not supported on PHP 7.2 & 7.3, the local Docker environment has used the `--default-authentication-plugin` system variable to always make use of `mysql_native_password` despite MySQL 8.0 deprecating this auth plugin.
However in MySQL 8.4, the `--default-authentication-plugin` option was removed in favor of `--authentication-policy`, and `mysql_native_password` is now disabled by default. `mysql_native_password` has also been removed in MySQL 9.0.
This change adds support to the local Docker environment for MySQL 8.4 by adding some helper functions that determine which authentication plugin should be used based on the configured PHP/MySQL versions and automatically making the necessary configuration adjustments.
Props ayeshrajans, johnbillion, aristath, jorbin.
See #61218.
Built from https://develop.svn.wordpress.org/trunk@59279
git-svn-id: http://core.svn.wordpress.org/trunk@58671 1a063a9b-81f0-0310-95a4-ce76da25c4cd