Commit Graph

31937 Commits

Author SHA1 Message Date
hellofromTonya
b8322a053e Code Modernization: Fix null to non-nullable deprecation in wp_privacy_anonymize_ip().
The `wp_privacy_anonymize_ip()` function expects a string for the `$ip_addr` parameter, but did not do any input validation.

One of the pre-existing test cases, passed `null` to the function, leading to a `substr_count(): Passing null to parameter #1 ($haystack) of type string is deprecated` notice on PHP 8.1.

Fixed now by doing a cursory check on the variable at the start of the function and bowing out early for a number of cases (`null`, `false`, `0`, `''`) which would all result in the same `0.0.0.0` output anyway.

Follow-up [42971].

Props jrf, hellofromTonya.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51793


git-svn-id: http://core.svn.wordpress.org/trunk@51400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 22:56:56 +00:00
hellofromTonya
78b5f27b1e Tests: Add more invalid IP test cases and @covers to Tests_Functions_Anonymization.
Adds a few more invalid IP test cases.

Adds extra `@covers` tag for the two functions which are testing the `wp_privacy_anonymize_ip()` function.

(At class level, the `wp_privacy_anonymize_data()` is set as covered).

Follow-up to [42971].

Props jrf, hellofromTonya.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51792


git-svn-id: http://core.svn.wordpress.org/trunk@51399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 22:44:56 +00:00
hellofromTonya
07139653b9 Widgets: Revert [51705].
While the new name is much better, it doesn't fully tell what will happen when invoked nor does it fully solve the root problems. 

Why? The function is doing too much. And naming is hard.

Props azaozz, desrosj, andraganescu, zieladam, hellofromTonya.
See #53811.
Built from https://develop.svn.wordpress.org/trunk@51791


git-svn-id: http://core.svn.wordpress.org/trunk@51398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 21:40:57 +00:00
hellofromTonya
1d0e1397fd Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Image_Editor::save().
Renames the first parameter in `WP_Image_Editor_GD::save()` to match the parent's method signature.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Adds @since to clearly specify why the change happened.

Adds parameter descriptions to parent and both child classes. 

Follow-up to [22094], [22619], [30681].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51790


git-svn-id: http://core.svn.wordpress.org/trunk@51397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 20:39:58 +00:00
hellofromTonya
68e0c5e520 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Widget::update().
In each child class, renames the parameter to match the parent's method signature.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Adds @since to clearly specify why the change happened.

Replaces the original with the variable name with within each method.
Why? The new name is more specific and descriptive, which improves readability.

Follow-up to [10782], [25090], [26556], [40640].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51789


git-svn-id: http://core.svn.wordpress.org/trunk@51396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 20:13:57 +00:00
hellofromTonya
f2f05f8e04 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Sitemaps_Provider::get_max_num_pages().
In each child class, renames the parameter to match the parent's method signature.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Adds @since to clearly specify why the change happened.

Reassigns the generic parameter to the original parameter.
Why? Restoring the original name keeps the context intact within the method and makes the code more readable. An inline comment explains why this reassignment is made.

Note: Reassignment is done after the guard clause.
Why? To avoid unnecessary processing and memory should the method bail out.

Follow-up to [48072].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51788


git-svn-id: http://core.svn.wordpress.org/trunk@51395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 19:42:56 +00:00
hellofromTonya
a4b163a674 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Sitemaps_Provider::get_url_list().
In each child and grandchild class, renames the second parameter to match the parent's method signature.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Adds @since to clearly specify why the change happened.

Reassigns the generic parameter to the original parameter.
Why? Restoring the original name keeps the context intact within the method and makes the code more readable. An inline comment explains why this reassignment is made.

Follow-up to [48072].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51787


git-svn-id: http://core.svn.wordpress.org/trunk@51394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 19:21:57 +00:00
hellofromTonya
41307cd4e6 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_REST_Controller::prepare_item_for_response().
In each child and grandchild class, renames the first parameter to match the parent's method signature.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [38832], [39011], [39015], [39021], [39024], [39025], [39031], [39036], [43519], [43735], [43739], [43768], [46821], [48173], [48242], [49088], [50995], [51003], [51021].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51786


git-svn-id: http://core.svn.wordpress.org/trunk@51393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 18:36:57 +00:00
hellofromTonya
aaee916444 Code Modernization: Fix parameter name mismatch with parent in WP_Customize_Custom_CSS_Setting::validate().
Renames the parameter to match the parent's method signature.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Adds `@since` to clearly specify why the change happened.

Reassigns the generic parameter to the original parameter.
Why? Restoring the original name keeps the context intact within the method and makes the code more readable. An inline comment explains why this reassignment is made

Follow-up to [37476], [38829], [41376].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51785


git-svn-id: http://core.svn.wordpress.org/trunk@51392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 15:18:55 +00:00
hellofromTonya
6a19a16872 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Customize_Setting::update().
In each child class: renames the parameter to match the parent's method signature.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [19995], [21037], [21053], [21354], [38829], [51298].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51784


git-svn-id: http://core.svn.wordpress.org/trunk@51391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 14:48:55 +00:00
hellofromTonya
071c322bf2 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Customize_Setting::sanitize().
In each child class: renames the parameter to match the parent's method signature.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [19995], [32806].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51783


git-svn-id: http://core.svn.wordpress.org/trunk@51390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 14:32:57 +00:00
hellofromTonya
5887edee86 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Upgrader_Skin::error().
In each child class: renames the parameter to match the parent's method signature.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

Follow-up to [11005], [25806], [32655], [38199].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51782


git-svn-id: http://core.svn.wordpress.org/trunk@51389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 13:59:56 +00:00
hellofromTonya
03331f52ff Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in WP_Upgrader_Skin::feedback().
In the parent class, renames the parameter `$string` to `$feedback`.
Why? `string` is a PHP reserved keyword.

In each child class: renames the parameter to match the parent's method signature.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

Follow-up to [11005], [25228], [30680], [32655], [38199], [49596].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51781


git-svn-id: http://core.svn.wordpress.org/trunk@51388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 13:48:56 +00:00
hellofromTonya
a395d4c50e Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in Walker::end_el().
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword. The parameter name is selected for consistency with `Walker::start_el()`.

In each child class: renames the parameter to match the parent's method signature.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

Follow-up to [7737], [8900], [8970], [14248], [16100], [25642], [25644], [37051], [37056].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51780


git-svn-id: http://core.svn.wordpress.org/trunk@51387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 13:03:55 +00:00
hellofromTonya
7abc752329 Code Modernization: Fix last parameter name mismatches for parent/child classes in Walker::start_el().
The parent class uses `$current_object_id` while most of the child classes use `$id`. As the parent class' is more descriptive, renaming the last parameter in each of child class.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

- In cases where the original parameter name was too generic or misleading, renamed (when reassigning) to a more descriptive name for use within the method.

Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189], [51739].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51779


git-svn-id: http://core.svn.wordpress.org/trunk@51386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 12:39:59 +00:00
Andrew Ozz
0fcde6de17 Editor: Revert [51748] and [51649]. They intorduced a bug where wp.editor may be replaced with wp.oldEditor in certain cases.
Props desrosj, davidbinda, azaozz.
Fixes #53762.
Built from https://develop.svn.wordpress.org/trunk@51768


git-svn-id: http://core.svn.wordpress.org/trunk@51375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 23:29:58 +00:00
Andrew Ozz
03bbf916a9 Editor: fix the replacement of wp.editor with wp.oldEditor in the inline script outputted when enqueueing the old editor.
Props fullofcaffeine, davidbinda, grantmkin, get_dave, azaozz.
Fixes #53762.
Built from https://develop.svn.wordpress.org/trunk@51748


git-svn-id: http://core.svn.wordpress.org/trunk@51356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 19:16:02 +00:00
Sergey Biryukov
e1e1d021ea General: Only use _jsonp_wp_die_handler() for JSONP REST API requests.
Props mdawaffe, peterwilsoncc.
Built from https://develop.svn.wordpress.org/trunk@51740


git-svn-id: http://core.svn.wordpress.org/trunk@51348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 17:16:57 +00:00
hellofromTonya
1105ddf965 Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in Walker::start_el().
In the parent class, renames the parameter `$object` to `$data_object`.

Why? `object` is a PHP reserved keyword.

In each child class: renames the corresponding parameter to match the parent's method signature.

Why? 

PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.

Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739


git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 15:36:59 +00:00
John Blackbourn
25da00ea81 Users: Introduce a meta_input argument for wp_insert_user().
This allows custom user meta values to be provided when creating or updating a user in the same way custom post meta can be provided to `wp_insert_post()` when creating or updating a post.

Also introduces the `insert_custom_user_meta` to filter these values.

Props desrosj, donmhico

Fixes #41950

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


git-svn-id: http://core.svn.wordpress.org/trunk@51346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 21:31:55 +00:00
hellofromTonya
aebe05f6f4 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_List_Table::handle_row_actions().
Matches the method signatures of the parent class and each child class.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

For readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened

- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [32644], [32664], [32798], [38489], [49183], [49197].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51737


git-svn-id: http://core.svn.wordpress.org/trunk@51345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 19:24:53 +00:00
John Blackbourn
172541c6f1 Build/Test Tools: Fix CI for running tests on PHP 8.1.
This fixes the CI for PHP 8.1 while retaining the needed improvements for local testing when running `npm run test:php-composer` by:

* Replacing the npm script with the full node command
* Removing the `composer update` command from the `env:install` process

Props BinaryKitten, hellofromTonya

See #53945

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


git-svn-id: http://core.svn.wordpress.org/trunk@51344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 19:23:56 +00:00
hellofromTonya
7d6a70107a Code Modernization: Fix parameter name mismatches for parent/child classes in WP_List_Table::column_cb().
Matches the method signatures of the parent class and each child class.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

For readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened

- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [15632], [30679], [31210], [32740], [32753], [32754], [32755], [32756], [32757].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51735


git-svn-id: http://core.svn.wordpress.org/trunk@51343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 18:19:56 +00:00
hellofromTonya
213ce0c7ea Code Modernization: Improve @since message in WP_List_Table::column_default().
Improves the `@since` message to more clearly specify the reason for this change" for PHP 8 named parameter support.

Follow-up to [51728].

Props jrf.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51734


git-svn-id: http://core.svn.wordpress.org/trunk@51342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 16:57:58 +00:00
Sergey Biryukov
5a7eca9a0e Docs: Correct documentation for the in_plugin_update_message-{$file} filter.
The `$response` parameter is an object, not an array.

This is a minor inconsistency with the corresponding `in_theme_update_message-{$theme_key}` action for themes, where the `$response` parameter is an array.

For backward compatibility, it is safer not to change the parameter type at this point, but to make sure the documentation is correct.

Follow-up to [11193], [16141], [26540].

Props davidmosterd, audrasjb, SergeyBiryukov.
See #40006.
Built from https://develop.svn.wordpress.org/trunk@51733


git-svn-id: http://core.svn.wordpress.org/trunk@51341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 12:55:00 +00:00
Sergey Biryukov
de70e2c68b Docs: Correct the post_submitbox_minor_actions hook description.
The action fires after the Save Draft (or Save as Pending) and Preview (or Preview Changes) buttons in the Publish meta box.

The previous description stated that the action fires before the post date/time setting, which was not quite correct, as there are also post status and visibility settings between the action and the date/time setting.

Follow-up to [34895].

Props bedas, audrasjb.
Fixes #54045.
Built from https://develop.svn.wordpress.org/trunk@51732


git-svn-id: http://core.svn.wordpress.org/trunk@51338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-06 13:36:01 +00:00
Sergey Biryukov
c5d96d88a3 Docs: Сlarify that term_id is a valid value for the $field parameter of get_term_by().
As `term_id` is the actual property name of the `WP_Term`, it should appear first and we should make it more clear that `id` and `ID` are aliases.

Follow-up to [6254], [25334], [38677], [47865], [47870].

Props gazchap, audrasjb.
Fixes #54065.
Built from https://develop.svn.wordpress.org/trunk@51731


git-svn-id: http://core.svn.wordpress.org/trunk@51337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-05 11:06:59 +00:00
Sergey Biryukov
bd3465828e Docs: Fix typo in a comment in WP_Customize_Manager::get_return_url().
Follow-up to [46754].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51730


git-svn-id: http://core.svn.wordpress.org/trunk@51336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-04 00:39:04 +00:00
Sergey Biryukov
15e552e105 Docs: Move @since notes from the safe_style_css filter to the safecss_filter_attr() function.
The filter allows to modify the list of allowed CSS attributes, however support for specific CSS attributes is added to the function rather than the filter.

Follow-up to [37931], [38121], [42880], [44136], [44531], [45242], [45363], [46235], [46793], [50634], [50923].

Props tmatsuur, muhammadfaizanhaidar, sabernhardt.
Fixes #53731.
Built from https://develop.svn.wordpress.org/trunk@51729


git-svn-id: http://core.svn.wordpress.org/trunk@51335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-03 01:37:57 +00:00
hellofromTonya
2c91899724 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_List_Table::column_default().
Matches the method signatures of the parent class and each child class.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

For readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened

- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [15632], [30679], [31210], [32740], [32753], [32754], [32755], [32756], [32757].

Props jrf, hellofromTonya, @sergeybiryukov, @azaozz, @desrosj, @johnbillion
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51728


git-svn-id: http://core.svn.wordpress.org/trunk@51334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-02 22:26:56 +00:00
ryelle
c11fbdc7ae Coding Standards: Apply coding standards on CSS.
Remove units when the value is zero. Combine redundant values in shorthand declarations.
This was generated with `stylelint --fix` and a custom config (see #53866).

Props ankitmaru, audrasjb, pbiron, ayeshrajans, hareesh-pillai, netweb, mukesh27.
Fixes #53866.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-02 22:18:00 +00:00
Sergey Biryukov
fcc79f847a Docs: Provide a more accurate description for a few script and style functions.
This should make it clear that the functions only work if the script or style has already been registered.

This affects:
* `wp_localize_script()`
* `wp_set_script_translations()`
* `wp_script_add_data()`
* `wp_style_add_data()`

Follow-up to [7970], [18464], [25594], [31223], [36633], [44169], [44350].

Props audrasjb.
Fixes #54044.
Built from https://develop.svn.wordpress.org/trunk@51726


git-svn-id: http://core.svn.wordpress.org/trunk@51332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-02 08:30:58 +00:00
hellofromTonya
9b3202eafd Tests: Add missing @covers tags for Tests_Admin_wpCommunityEvents.
Adds missing and moves placement of existing @covers tags for consistency.

Follow-up to [40607], [42726], [49145].

Props pbearne, jrf, hellofromTonya.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@51725


git-svn-id: http://core.svn.wordpress.org/trunk@51331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 22:27:57 +00:00
hellofromTonya
380b5563ad Tests: Add missing @covers tags for Tests_Admin_IncludesComment.
Follow-up to [34456], [34460].

Props pbearne, jrf, hellofromTonya.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@51724


git-svn-id: http://core.svn.wordpress.org/trunk@51330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 21:59:56 +00:00
desrosj
c886de61f9 Editor: Update block editor packages for WordPress 5.8.1.
The following packages were updated:
- @wordpress/a11y to `3.1.2`
- @wordpress/annotations to `2.1.6`
- @wordpress/api-fetch to `5.1.2`
- @wordpress/autop to `3.1.2`
- @wordpress/babel-preset-default to `6.2.1`
- @wordpress/blob to `3.1.2`
- @wordpress/block-directory to `2.1.21`
- @wordpress/block-editor to `6.1.14`
- @wordpress/block-library to `3.2.19`
- @wordpress/block-serialization-default-parser to `4.1.2`
- @wordpress/blocks to `9.1.8`
- @wordpress/components to `14.1.11`
- @wordpress/compose to `4.1.6`
- @wordpress/core-data to `3.1.12`
- @wordpress/customize-widgets to `1.0.20`
- @wordpress/data-controls to `2.1.6`
- @wordpress/data to `5.1.6`
- @wordpress/date to `4.1.2`
- @wordpress/deprecated to `3.1.2`
- @wordpress/dom-ready to `3.1.2`
- @wordpress/dom to `3.1.5`
- @wordpress/e2e-test-utils to `5.3.1`
- @wordpress/edit-post to `4.1.21`
- @wordpress/edit-widgets to `2.1.21`
- @wordpress/editor to `10.1.17`
- @wordpress/element to `3.1.2`
- @wordpress/escape-html to `2.1.2`
- @wordpress/format-library to `2.1.14`
- @wordpress/html-entities to `3.1.2`
- @wordpress/i18n to `4.1.2`
- @wordpress/icons to `4.0.3`
- @wordpress/interface to `3.1.12`
- @wordpress/keyboard-shortcuts to `2.1.7`
- @wordpress/keycodes to `3.1.2`
- @wordpress/list-reusable-blocks to `2.1.11`
- @wordpress/media-utils to `2.1.2`
- @wordpress/notices to `3.1.6`
- @wordpress/nux to `4.1.11`
- @wordpress/plugins to `3.1.6`
- @wordpress/primitives to `2.1.2`
- @wordpress/priority-queue to `2.1.2`
- @wordpress/react-i18n to `2.1.2`
- @wordpress/redux-routine to `4.1.2`
- @wordpress/reusable-blocks to `2.1.17`
- @wordpress/rich-text to `4.1.6`
- @wordpress/scripts to `16.1.5`
- @wordpress/server-side-render to `2.1.12`
- @wordpress/shortcode to `3.1.2`
- @wordpress/url to `3.1.2`
- @wordpress/viewport to `3.1.6`
- @wordpress/warning to `2.1.2`
- @wordpress/widgets to `1.1.19`
- @wordpress/wordcount to `3.1.2`

Props oandregal, juanmaguitar, gziolo, jblz, talldanwp, ribaricplusplus, peterwisoncc, youknowriad, paaljoachim, kreppar, ellatrix, aristath, walbo, ajlende, kevin940726, mamaduka, ntsekouras, toro_unit, mkaz, joen, noisysocks, zieladam, andraganescu, antonvlasenko, terraling, dariak, vladytimy, circlecube, desrosj.
Fixes #54052, #52818.
Built from https://develop.svn.wordpress.org/trunk@51719


git-svn-id: http://core.svn.wordpress.org/trunk@51325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 19:08:24 +00:00
desrosj
da38a95d77 Media: Remove documentation detailing specific edge cases in the image_editor_output_format filter.
In [51422], a few specific edge cases were detailed so that developers using the hook were aware of known pitfalls.

These edge cases have been fixed in 5.8.1 through [51653] and [51704], so the documentation is no longer necessary.

Props azaozz, audrasjb.
Fixes #53955.
Built from https://develop.svn.wordpress.org/trunk@51717


git-svn-id: http://core.svn.wordpress.org/trunk@51323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 17:17:58 +00:00
noisysocks
9697e5a63b Customize: Add wp-embed-responsive class to body if using widgets block editor
Appends the wp-embed-responsive class to the body if the widgets block editor is
enabled. This fixes a bug preventing embeds (e.g. YouTube embeds) appearing in
the widgets block editor.

Fixes #53609.
Props walbo, kevin940726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 07:10:56 +00:00
Sergey Biryukov
049bbe8356 Site Health: Remove MySQL query cache size from the Site Health Info screen.
The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0.

Reference: [https://dev.mysql.com/doc/refman/5.7/en/query-cache-configuration.html MySQL 5.7 Reference Manual: Query Cache Configuration].

Follow-up to [51522], [51523].

Props johnbillion, zodiac1978.
Fixes #53845.
Built from https://develop.svn.wordpress.org/trunk@51715


git-svn-id: http://core.svn.wordpress.org/trunk@51321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 07:01:56 +00:00
Peter Wilson
33f4f396ef Build: Clean css/dist as part of the webpack build step.
Move the cleaning of the `wp-includes/css/dist` folder from `clean:css` to `clean:webpack-assets` to avoid an order of operations issue in which the files were built shortly before been deleted later in the build process.

Follow up to [51689].

Props netweb, ramonopoly, peterwilsoncc.
Fixes #53719.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 04:00:59 +00:00
desrosj
3dd999bb14 Build/Test Tools: Double escape quotation marks() for Slack “messages”.
This prevents quotation marks from producing invalid JSON errors.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51709


git-svn-id: http://core.svn.wordpress.org/trunk@51315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 00:26:55 +00:00
hellofromTonya
71977c215d Widgets: Rename and soft deprecate retrieve_widgets().
The original name `retrieve_widgets()` was unclear as it suggested it was a getter, i.e. getting the widgets. This function does more than get: finds orphaned widgets, assigns them to the inactive sidebar, and updates the database.

The new name is `sync_registered_widgets()` which better represents what happens when this function is invoked.

The original `retrieve_widgets()` function is soft deprecated to avoid unnecessary code churn downstream for developers that support more than the latest version of WordPress.

Follow-up to [18630].

Props zieladam, timothyblynjacobs, andraganescu, hellofromTonya.
See #53811.
Built from https://develop.svn.wordpress.org/trunk@51705


git-svn-id: http://core.svn.wordpress.org/trunk@51311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-31 19:58:58 +00:00
Andrew Ozz
f405add8f0 Media: apply the wp_editor_set_quality filter not only when loading an image in the editor but also when saving an converted image, after the mime-type of the output image has changed.
Props mikeschroder, desrosj, azaozz.
Fixes #53667.
Built from https://develop.svn.wordpress.org/trunk@51704


git-svn-id: http://core.svn.wordpress.org/trunk@51310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-31 18:59:03 +00:00
Andrew Ozz
4112d77597 Media: fix showing of the "Filter Media" filds when replacing an image from the media modal.
Props mhuntdesign, sabernhardt, azaozz.
Fixes #53833.
Built from https://develop.svn.wordpress.org/trunk@51703


git-svn-id: http://core.svn.wordpress.org/trunk@51309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-31 17:27:57 +00:00
hellofromTonya
46ba4f8b70 Tests: Add missing @covers tags for actions' tests.
Props pbearne, hudson-atwell, jrf, hellofromTonya.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@51702


git-svn-id: http://core.svn.wordpress.org/trunk@51308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-31 17:23:55 +00:00
desrosj
e91f690333 Widgets: Show title and media select fields in Accessibility Mode.
This updates the Custom HTML and Media widgets to display the correct fields when adding or editing a widget when using accessibility mode through the Classic Widgets experience.

Follow up to [49973].

Props mark-k, sabernhardt, alexstine, circlecube, audrasjb.
Fixes #53641.
Built from https://develop.svn.wordpress.org/trunk@51701


git-svn-id: http://core.svn.wordpress.org/trunk@51307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-31 13:51:00 +00:00
Sergey Biryukov
892c8ecbdb Widgets: Pass correct context to get_block_categories() calls.
The `get_block_categories()` function expects either a `WP_Post` or a `WP_Block_Editor_Context` instance as the context argument, not a string.

Follow-up to [50996], [50997].

Props Enchiridion, pbearne, audrasjb.
Fixes #53757.
Built from https://develop.svn.wordpress.org/trunk@51700


git-svn-id: http://core.svn.wordpress.org/trunk@51306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-31 13:38:58 +00:00
Sergey Biryukov
c73609fe10 Docs: Improve documentation in wp-signup.php.
* Document the `$active_signup` global in `signup_user()`.
* Update some DocBlocks per the documentation standards.
* Expand some function descriptions for clarity.

Follow-up to [37535], [37536], [41200], [43326], [49078], [50828].

Props mt8.biz, sabernhardt, audrasjb, westonruter, jayupadhyay01, mukesh27, SergeyBiryukov.
Fixes #41566.
Built from https://develop.svn.wordpress.org/trunk@51699


git-svn-id: http://core.svn.wordpress.org/trunk@51305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-31 12:25:00 +00:00
hellofromTonya
4abb89f6c6 Tests: Do whitespace replacement in assertDiscardWhitespace() only when string.
The `assertDiscardWhitespace()` method uses `assertEquals()` under the hood, meaning that in reality any type of actual/expected value should be accepted by the function. Fixed the documentation to reflect that.

At the same time, only strings can contain whitespace differences. So the whitespace replacement should only be done when string values are passed.

This change (a) prevents potential `passing null to non-nullable` errors on PHP 8.1, if either of the inputs would turn out to be `null` and (b) increases tests stability.

Follow-up to [35003], [44902].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51698


git-svn-id: http://core.svn.wordpress.org/trunk@51304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 20:41:59 +00:00
hellofromTonya
702ea22639 Tests: Test custom assertions parameter data type in WP_UnitTestCase_Base.
The following changes improve tests stability.

The `assertEqualFields()` method expects an object and a fields array as inputs and subsequently approaches the received parameters as such, but did not verify whether the received parameters are of the expected types.

Along the same lines, the `assertSameSets()`, `assertEqualSets()`, `assertSameSetsWithIndex()` and the `assertEqualSetsWithIndex()` methods all expect arrays for both the actual as well as the expected values and uses the array function `[k]sort()` on both, but never verified that the received inputs were actually arrays, which could lead to PHP errors on the sorting function calls.

Follow-up to [30687], [42343], [48937], [48939], [51480], [51481].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51697


git-svn-id: http://core.svn.wordpress.org/trunk@51303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 20:19:59 +00:00
hellofromTonya
6b2eccb0e3 Code Modernization: Add input validation to _set_cron_array().
The private `_set_cron_array()` function expects a cron array as the first parameter, but will often be passed the - potentially updated - output of a call to `_get_cron_array()`.

When the `_get_cron_array()` function returns `false`, a "Deprecated: Automatic conversion of false to array is deprecated" warning will be thrown on PHP 8.1.

The input validation resolves the deprecation warning by setting the cron value to an empty array when not given an `array` data type.

Adds a full set of `_set_cron_array()` tests.

Follow-up to [4189], [50152].

Props jrf, hellofromTonya, peterwilsoncc.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51695


git-svn-id: http://core.svn.wordpress.org/trunk@51301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 15:20:56 +00:00
desrosj
5090761b4f Coding Standards: Apply some minor alignment fixes.
These are updates caused by running `composer format`.

Follow up to [51501], [51599], [51618], [51653].
See #53359, #50542, #53238, #53668, #53690.
Built from https://develop.svn.wordpress.org/trunk@51693


git-svn-id: http://core.svn.wordpress.org/trunk@51299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 14:09:58 +00:00
Sergey Biryukov
09f22e5b24 External Libraries: Update whatwg-fetch package to version 3.6.2.
This matches the version used in the Gutenberg project.

While WordPress core no longer depends on this polyfill as of [50934], this brings the latest updates of the library to anyone still utilizing it.

For a full list of changes in this update, see the `whatwg-fetch` GitHub:
https://github.com/github/fetch/compare/v3.0.0...v3.6.2

Follow-up to [43719], [50934].

Props hareesh-pillai, rsiddharth, desrosj.
Fixes #53929.
Built from https://develop.svn.wordpress.org/trunk@51692


git-svn-id: http://core.svn.wordpress.org/trunk@51298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 13:51:11 +00:00
Peter Wilson
1ac69fa78e Build: Remove css/dist in grunt clean command.
Modify the `grunt clean:css` command to include the folder `wp-includes/css/dist` to ensure legacy files do not remain if the built files are removed/relocated.

Props desrosj, netweb.
Fixes #53719.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 04:35:57 +00:00
Peter Wilson
34d8dd914c Menus: Save display locations for new menus.
Fixes a bug preventing the locations saving when creating a new menu. Introduced in [50938].

Props dlh, andraganescu, mukesh27, desrosj.
Fixes #53877.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 04:12:57 +00:00
Sergey Biryukov
26a276db6f Filesystem API: Make sure to only call fread() on non-empty files in PclZip::privAddFile().
This avoids a fatal error on PHP 8 caused by passing a zero value to `fread()` as the `$length` argument, which must be greater than zero.

This commit also amends the previous solution for similar issues elsewhere in the file to ensure consistent type for string values, instead of changing the type from `string` to `bool` when trying to read from an empty file.

Follow-up to [50355].

Props DavidAnderson, jrf, SergeyBiryukov.
Fixes #54036.
Built from https://develop.svn.wordpress.org/trunk@51686


git-svn-id: http://core.svn.wordpress.org/trunk@51292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-29 01:33:58 +00:00
John Blackbourn
b441808aee Build/Test Tools: Install the Composer package dependencies within the Docker environment as part of the local development environment installation and testing processes.
This makes the use of Composer on the host machine optional when using the Docker environment, which means there is no change to the process for installing, updating, and running the tests since [51559].

Props hellofromTonya, azaozz, netweb, desrosj, jrf, johnbillion

Fixes #53945

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


git-svn-id: http://core.svn.wordpress.org/trunk@51291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-28 21:17:56 +00:00
John Blackbourn
80c7b3cdf3 Administration: Remove a misleading pointer cursor from list items in the admin menu.
This prevents unclickable areas within the menu from appearing clickable.

Props circlecube, kurudrive, ryelle, opurockey

Fixes #51551

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


git-svn-id: http://core.svn.wordpress.org/trunk@51290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-28 13:45:56 +00:00
Sergey Biryukov
42c7a1fad5 Coding Standards: Fix WPCS issue in [51682].
This fixes a "Misleading line break before `'||'`; readers may interpret this as an expression boundary" error.

See #54030.
Built from https://develop.svn.wordpress.org/trunk@51683


git-svn-id: http://core.svn.wordpress.org/trunk@51289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-28 01:34:56 +00:00
Sergey Biryukov
79b0d3f3e8 Customize: Prevent collapsing expanded panel/section/control when Esc is pressed on a block editor instance.
This ensures that the current panel is not collapsed when hitting `Esc` with the focus on the widget block editor.

Follow-up to [37347], [39120].

Props gwwar, dlh.
Fixes #54030.
Built from https://develop.svn.wordpress.org/trunk@51682


git-svn-id: http://core.svn.wordpress.org/trunk@51288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-28 01:25:59 +00:00
desrosj
ed0e054f34 Build/Test Tools: Preserve text within backticks in Slack notifications.
Props SergeyBiryukov, johnbillion, earnjam.
See #52644.
Built from https://develop.svn.wordpress.org/trunk@51679


git-svn-id: http://core.svn.wordpress.org/trunk@51285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-27 17:35:58 +00:00
Sergey Biryukov
0ae0fbedce Plugins: Display a message on Plugins list table if a plugin requires a higher version of PHP or WordPress.
Installation and activation of incompatible plugins was previously disallowed in [43436] and [44978], but if such a plugin was installed manually, there was nothing on the Plugins screen that would show its compatibility status.

Showing an appropriate notice with a documentation link makes the UI more consistent and improves user experience.

Follow-up to [43436], [44937], [44939], [44978], [45043], [45165], [45546], [47573], [47816], [47819], [48172], [48636], [48637], [48638], [48640], [48652], [48653], [48654], [48660].

Props TacoVerdo, SergeyBiryukov.
Fixes #53990.
Built from https://develop.svn.wordpress.org/trunk@51678


git-svn-id: http://core.svn.wordpress.org/trunk@51284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-27 15:43:57 +00:00
Mike Schroder
9aeacc728a Customizer: Respect prefers-reduced-motion media query in Customizer animations.
Disables Customizer animations when media query `prefers-reduced-motion: reduce` returns true.

Continues the effort to reduce motion within the WordPress admin panel when users have enabled this feature in their operating system or browser.

It has the additional effect of making the Block Editor's end-to-end tests run faster, as explored initially with a different approach in #53562.

See https://github.com/WordPress/gutenberg/issues/32024 for the related Gutenberg issue.

See https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion for ways to enable this feature on various platforms.

Props kevin940726, isabel_brison, zieladam, youknowriad, desrosj, mamaduka, mikeschroder.
Previously [51389], [50028], [47813].
Fixes #53542.
Built from https://develop.svn.wordpress.org/trunk@51677


git-svn-id: http://core.svn.wordpress.org/trunk@51283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-27 09:36:57 +00:00
John Blackbourn
b3226d8e62 REST API: Correct the description for the last_updated property in the block-directory endpoint.
This field shows the date in ISO 8601 format.

Fixes #53595

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


git-svn-id: http://core.svn.wordpress.org/trunk@51282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 19:34:56 +00:00
John Blackbourn
52d6bd3529 Security: Correct the inline docs for the wp_kses_allowed_html filter.
Props peterwilsoncc

Fixes #53597

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


git-svn-id: http://core.svn.wordpress.org/trunk@51281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 19:28:57 +00:00
desrosj
9bc8352b00 Editor: Ensure block attribute serialization in PHP matches the JavaScript equivalent.
The `serializeAttributes()` function in JavaScript uses `JSON.stringify`, which does not encode slashes and unicode characters by default. This resulted in the PHP serialization through `json_encode()` producing different results.

This also switches from `json_encode()` to `wp_json_encode()` to prevent failures when any non UTF-8 characters are included.

Props kevinfodness, SergeyBiryukov, timothyblynjacobs.
Fixes #53936.
Built from https://develop.svn.wordpress.org/trunk@51674


git-svn-id: http://core.svn.wordpress.org/trunk@51280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 19:10:58 +00:00
desrosj
b6f34e7b44 Build/Test Tools: Use list format when defining environment variables in Docker compose file.
This is the correct formatting detailed in the Docker `compose` documentation examples and helps to avoid ambiguities in the yaml parser when values that may cause warnings.

Props pbrearne, ocean90, johnbillion, desrosj.
Fixes #53820.
Built from https://develop.svn.wordpress.org/trunk@51673


git-svn-id: http://core.svn.wordpress.org/trunk@51279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 18:41:58 +00:00
ryelle
e32d9ec522 Toolbar: Provide a CSS custom property for the admin bar height.
This new custom property, `--wp-admin--admin-bar--height`, reflects the admin bar's height and adjusts responsively on smaller screens. It can be used to offset content to avoid overlapping the admin bar, without needing to copy the media query.

This also removes a workaround only needed for Internet Explorer 6 and below.

Props nico23, sabernhardt.
Fixes #52623.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 18:24:58 +00:00
desrosj
2ddca7fd4a Build/Test Tools: Remove shell: bash from code coverage workflow.
bash is the default shell for all non-Windows GitHub Action runners, so this is not necessary.

Follow up to [51670].
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51671


git-svn-id: http://core.svn.wordpress.org/trunk@51277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 18:22:57 +00:00
desrosj
59faf7aeb6 Build/Test Tools: Remove shell: bash from PHPUnit test workflow.
bash is the default shell for all non-Windows GitHub Action runners, so this is not necessary.

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51670


git-svn-id: http://core.svn.wordpress.org/trunk@51276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 18:21:58 +00:00
hellofromTonya
31def8058e Tests: Improve bootstrap error message for when ABSPATH folder does not exist.
The PHPUnit tests are/should generally be run on the `src` directory, so changes just made can be tested. While testing via the `build` directory is also still supported, this is not the default.

This was last changed in [50441], but that commit did not remove/update the error message thrown by the test bootstrap file.

This last change also did not take into account that that change meant that people had to update their own `wp`tests-config.php` file to match the change made in Core and would otherwise still get the outdated error message.

This commit changes the messaging in the test bootstrap file to be more in line with the current reality, while still accounting for the fact that tests can be run from both `src` as well as `build`.

Follow-up to [49569], [50441], [51581].
Props jrf, hellofromTonya.
Built from https://develop.svn.wordpress.org/trunk@51669


git-svn-id: http://core.svn.wordpress.org/trunk@51275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 17:56:57 +00:00
Sergey Biryukov
1f7f8fb16a Coding Standards: Add missing visibility keywords for wp_filter_object_list() and wp_list_pluck() tests.
Follow-up to [51663-51667].

Props pbearne.
See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51668


git-svn-id: http://core.svn.wordpress.org/trunk@51274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:51:57 +00:00
Sergey Biryukov
4810f47fd5 Tests: Move wp_list_sort() tests to their own file.
This matches the name of the function being tested.

Follow-up to [38928], [51663-51666].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51667


git-svn-id: http://core.svn.wordpress.org/trunk@51273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:30:56 +00:00
Sergey Biryukov
48aa9e7147 Tests: Move wp_list_filter() tests to their own file.
This matches the name of the function being tested.

Follow-up to [38928], [51663-51665].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51666


git-svn-id: http://core.svn.wordpress.org/trunk@51272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:21:58 +00:00
Sergey Biryukov
5cfd90b427 Tests: Rename the test file and class for wp_filter_object_list() tests.
This matches the name of the function being tested.

Follow-up to [410/tests], [51663], [51664].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51665


git-svn-id: http://core.svn.wordpress.org/trunk@51271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:09:56 +00:00
Sergey Biryukov
18ef0d4252 Tests: Remove duplicate wp_list_pluck() tests.
The tests were partially duplicated in two separate files, and are now located in their own file.

Follow-up to [431/tests], [28900], [38928], [42527], [51663].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51664


git-svn-id: http://core.svn.wordpress.org/trunk@51270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:03:57 +00:00
Sergey Biryukov
a9cff26ae7 Tests: Move wp_list_pluck() tests to their own file.
The tests were partially duplicated in two separate files.

Follow-up to [431/tests], [28900], [38928], [42527].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51663


git-svn-id: http://core.svn.wordpress.org/trunk@51269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 15:55:57 +00:00
hellofromTonya
ab252fb910 Coding Standards: Fix indentation and remove ignore annotation in wp_privacy_send_personal_data_export_email().
Follow-up to [51129], [51410].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51662


git-svn-id: http://core.svn.wordpress.org/trunk@51268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 14:05:58 +00:00
hellofromTonya
2e9fe3c986 Coding Standards: Make ignore annotation more specific in WP_Site_Health_Auto_Updates::test_vcs_abspath().
Follow-up to [44986].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51661


git-svn-id: http://core.svn.wordpress.org/trunk@51267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:59:59 +00:00
hellofromTonya
a91fc400a0 Coding Standards: Remove redundant ignore annotation in populate_options().
Follow-up to [43627], [43628].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51660


git-svn-id: http://core.svn.wordpress.org/trunk@51266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:50:59 +00:00
hellofromTonya
90a950783d Coding Standards: Update the config for WordPress.PHP.FileName in PHPCS ruleset.
The WPCS sniff already takes the test classes in the `tests/phpunit/includes` directory into account.

Only the test cases outside of that directory, i.e. in the `tests/phpunit/tests` directory need to be listed here.

Includes alphabetizing the list.

Follow-up to [42346], [45607].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51659


git-svn-id: http://core.svn.wordpress.org/trunk@51265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:36:56 +00:00
hellofromTonya
958cd3a964 Coding Standards: Update the config for WordPress.PHP.NoSilencedErrors in PHPCS ruleset.
Follow-up to [45611].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51658


git-svn-id: http://core.svn.wordpress.org/trunk@51264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:20:56 +00:00
hellofromTonya
c7d3e267b8 Coding Standards: Use static closures when not using $this.
When a closure does not use `$this`, it can be made `static` for improved performance.

Static closures are supported in PHP since PHP 5.4. ​

Props jrf, hellofromTonya, swissspidy, SergeyBiryukov.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51657


git-svn-id: http://core.svn.wordpress.org/trunk@51263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 12:59:02 +00:00
Sergey Biryukov
622985b69c Docs: Add missing @since tag for the $check_signatures parameter of WP_Upgrader::run().
This matches the `WP_Upgrader::download_package()` documentation more closely.

Follow-up to [44954], [45262].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51655


git-svn-id: http://core.svn.wordpress.org/trunk@51261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-25 14:39:59 +00:00
Sergey Biryukov
d529999e5b Docs: Clarify a comment in WP_Upgrader::run().
This matches the `WP_Upgrader::download_package()` documentation more closely.

Follow-up to [11005], [30758], [33685].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51654


git-svn-id: http://core.svn.wordpress.org/trunk@51260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-24 23:10:06 +00:00
Andrew Ozz
94a990de99 Media: Fix wp_unique_filename() to check for name collisions with all alternate file names when an image may be converted after uploading. This includes possible collinions with pre-existing images whose sub-sizes/thumbnails are regenerated.
Props ianmjones, azaozz.
Fixes #53668.
Built from https://develop.svn.wordpress.org/trunk@51653


git-svn-id: http://core.svn.wordpress.org/trunk@51259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-24 20:52:03 +00:00
Sergey Biryukov
e53ffbaf95 Code Modernization: Pass correct default value to http_build_query() in WP_Sitemaps_Provider::get_sitemap_url().
The `WP_Sitemaps_Provider::get_sitemap_url()` method calls the PHP native `http_build_query()` function, the second parameter of which is the ''optional'' `$numeric_prefix` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.

In this case, this function call yielded a `http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without a backward compatibility break.

This change is already covered by tests as 14 of the existing tests failed on these function calls when running the tests on PHP 8.1.

References:
* [https://www.php.net/manual/en/function.http-build-query.php PHP Manual: http_build_query()]
* [https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg PHP RFC: Deprecate passing null to non-nullable arguments of internal functions]

Follow-up to [48470].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51652


git-svn-id: http://core.svn.wordpress.org/trunk@51258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-23 11:44:01 +00:00
Sergey Biryukov
cdf31027d6 Tests: Rename classes in phpunit/tests/feed/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51651


git-svn-id: http://core.svn.wordpress.org/trunk@51257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-22 10:08:59 +00:00
Sergey Biryukov
eec183cb63 Tests: Rename classes in phpunit/tests/error-protection/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51650


git-svn-id: http://core.svn.wordpress.org/trunk@51256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-21 15:34:01 +00:00
Andrew Ozz
774c8047c5 Editor: Replace the remaining references to wp.editor with wp.oldEditor.
Props zieladam.
Fixes #53762.
Built from https://develop.svn.wordpress.org/trunk@51649


git-svn-id: http://core.svn.wordpress.org/trunk@51255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-21 00:20:00 +00:00
Andrew Ozz
7fc3aae637 REST API: Remove trailing slashes when preloading requests and add unit tests for it.
Props antonvlasenko.
Fixes #51636.
Built from https://develop.svn.wordpress.org/trunk@51648


git-svn-id: http://core.svn.wordpress.org/trunk@51254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-20 23:44:57 +00:00
desrosj
f514f51180 Build/Test Tools: Include the commit short summary in Slack messages.
This gives more context to GitHub Action related Slack messages without the need to click the workflow URL, or unfurl the links (which shows lots of unnecessary information, such as the repository description and image).

Props earnjam.
See #52644.
Built from https://develop.svn.wordpress.org/trunk@51647


git-svn-id: http://core.svn.wordpress.org/trunk@51253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-20 19:00:00 +00:00
Sergey Biryukov
1be5d3e997 Tests: Rename classes in phpunit/tests/editor/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51646


git-svn-id: http://core.svn.wordpress.org/trunk@51252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-20 16:13:04 +00:00
ryelle
899e4635de Privacy: Add space below page selector.
Sometimes the submit button wraps to a new line, either because the button label translation is long, or there are long page names. When it wraps, there should be space between the select dropdown and the button.

Props audrasjb, mukesh27, guillaumeturpin.
Fixes #53782.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 20:58:57 +00:00
ryelle
9d2e8c096f Toolbar: Limit the icon transition style to color only.
When transition is `all`, it also applies to the icon size, which can cause a bug in Safari where icons get stuck in the wrong size when resizing the browser window. The only expected animation is on the color property, so the transition can be limited to just `color`.

Props johnjamesjacoby, sabernhardt, SergeyBiryukov, audrasjb.
Fixes #43423.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 17:24:55 +00:00
Sergey Biryukov
87bd00ac5b Tests: Move loading the WP_Community_Events class to set_up_before_class().
This ensures that the class is loaded once before the first test of the test case class is run, and `require_once()` is not unnecessarily called for each test method individually.

Follow-up to [40607], [51628].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51641


git-svn-id: http://core.svn.wordpress.org/trunk@51247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 14:00:57 +00:00
Sergey Biryukov
590f56db3b Tests: Rename classes in phpunit/tests/admin/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51639


git-svn-id: http://core.svn.wordpress.org/trunk@51245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 13:09:57 +00:00
Sergey Biryukov
ccbd16fef1 Media: Check the return type of _get_cron_array() in WP_Media_List_Table::prepare_items().
The following warnings could, in very select circumstances, be shown:
{{{
// PHP 8.0 and higher:
Warning: foreach() argument must be of type array|object, bool given

// PHP 5.6 – 7.4
Warning: Invalid argument supplied for foreach()
}}}

In `WP_Media_List_Table::prepare_items()`, the cron info array is retrieved via a call to `_get_cron_array()`, but as the documentation (correctly) states, the return type of that function is `array|false`, where `false` is returned for a virgin site, with no cron jobs scheduled yet.

However, no type check is done on the return value, and the method just blindly continues by using it in a `foreach`.

Fixed by adding validation for the returned value from `_get_cron_array()` and only running the `foreach` when the returned value is an array.

Reference: [https://developer.wordpress.org/reference/functions/_get_cron_array/ WordPress Developer Resources: _get_cron_array()]

Follow-up to [48417].

Props jrf, hellofromTonya, mukesh27.
Fixes #53949.
Built from https://develop.svn.wordpress.org/trunk@51638


git-svn-id: http://core.svn.wordpress.org/trunk@51244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 12:44:57 +00:00
Peter Wilson
cda7c787e8 Customize: Hide native control on background position field.
Hide the browser's native radio button on the custom background position selector in the Customizer and the legacy background screen. This fixes an issue causing both to display.

Props mukesh27, ravipatel, sabernhardt, walbo.
Fixes #53803.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 02:07:56 +00:00
Sergey Biryukov
27522c6f67 Code Modernization: Silence the deprecation warning for auto_detect_line_endings.
Since PHP 8.1, the `auto_detect_line_endings` setting is deprecated:

> The `auto_detect_line_endings` ini setting modifies the behavior of `file()` and `fgets()` to support an isolated `\r` (as opposed to `\n` or `\r\n`) as a newline character. These newlines were used by “Classic” Mac OS, a system which has been discontinued in 2001, nearly two decades ago. Interoperability with such systems is no longer relevant.

Reference: [https://wiki.php.net/rfc/deprecations_php_8_1#auto_detect_line_endings_ini_setting PHP RFC: Deprecations for PHP 8.1: auto_detect_line_endings ini setting]

> The `auto_detect_line_endings` ini setting has been deprecated. If necessary, handle `\r` line breaks manually instead.

Reference: [1cf4fb739f/UPGRADING (L456-L457) PHP 8.1 Upgrade Notes].

This commit fixes the warning when running tests for the `PO` class:
{{{
Deprecated: auto_detect_line_endings is deprecated in /var/www/src/wp-includes/pomo/po.php on line 16
}}}

While deprecated, the actual `auto_detect_line_endings` functionality has not been removed from PHP (yet) and will still work until PHP 9.0.

For now, we're silencing the deprecation notice as there may still be translation files around which haven't been updated in a long time and which still use the old MacOS standalone `\r` as a line ending.

This should be revisited when PHP 9.0 is in alpha/beta.

Follow-up to [51633].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51636


git-svn-id: http://core.svn.wordpress.org/trunk@51242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 21:58:57 +00:00
Sergey Biryukov
74b515c1ba External Libraries: Restore the phpcs:ignore statements in PHPMailer.
These are necessary for a passing PHP Compatibility scan.

Follow-up to [48045], [51634].

See #53953.
Built from https://develop.svn.wordpress.org/trunk@51635


git-svn-id: http://core.svn.wordpress.org/trunk@51241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 14:08:56 +00:00
Sergey Biryukov
fd5aea9246 External Libraries: Upgrade PHPMailer to version 6.5.1.
The latest release includes preliminary PHP 8.1 support, as well as some small bug fixes.

Release notes: https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.1

For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.5.0...v6.5.1

Follow-up to [50628], [50799], [51169].

Props jrf.
Fixes #53953.
Built from https://develop.svn.wordpress.org/trunk@51634


git-svn-id: http://core.svn.wordpress.org/trunk@51240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 13:53:58 +00:00
Sergey Biryukov
0a2c7dc86c Code Modernization: Only set auto_detect_line_endings in PHP < 8.1.
Since PHP 8.1, the `auto_detect_line_endings` setting is deprecated:

> The `auto_detect_line_endings` ini setting modifies the behavior of `file()` and `fgets()` to support an isolated `\r` (as opposed to `\n` or `\r\n`) as a newline character. These newlines were used by “Classic” Mac OS, a system which has been discontinued in 2001, nearly two decades ago. Interoperability with such systems is no longer relevant.

Reference: [https://wiki.php.net/rfc/deprecations_php_8_1#auto_detect_line_endings_ini_setting PHP RFC: Deprecations for PHP 8.1: auto_detect_line_endings ini setting]

> The `auto_detect_line_endings` ini setting has been deprecated. If necessary, handle `\r` line breaks manually instead.

Reference: [1cf4fb739f/UPGRADING (L456-L457) PHP 8.1 Upgrade Notes].

This commit fixes the warning when running tests for the `PO` class:
{{{
Deprecated: auto_detect_line_endings is deprecated in /var/www/src/wp-includes/pomo/po.php on line 16
}}}

Follow-up to [10584], [51628].

See #53635.
Built from https://develop.svn.wordpress.org/trunk@51633


git-svn-id: http://core.svn.wordpress.org/trunk@51239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 13:23:56 +00:00
Peter Wilson
43e86e620a Media: Increase number of media items displayed per page.
Increase the number of media items displayed per page from 40 to 80 to improve the experience for users navigating the library on sites with a large quantity of media in the library.

Props AlGala, antpb, hellofromTonya, joedolson, SergeyBiryukov, wb1234.
Fixes #53827.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 06:00:59 +00:00
Peter Wilson
c9bf6d13ef Media: Fix layout of media library modal on narrow screens.
Reduces the right margin of the media library modal on small and medium width screens to remove excess white-space. On very narrow screens this was preventing the media icons from displaying.

Props andraganescu, desrosj, joedolson, moch11, mukesh27, sabernhardt, SergeyBiryukov, zieladam.
Fixes #53679.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 05:37:57 +00:00
Sergey Biryukov
80548a4039 Code Modernization: Check the return type of parse_url() in ms_cookie_constants().
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

It is entirely possible for the `siteurl` option to not have a "path" component.

In PHP 8.1, this would lead to a `trim(): Passing null to parameter #1 ($string) of type string is deprecated` notice.

Changing the logic around and adding validation for the return type value of `parse_url()` prevents that.

As this function is declaring global constants, adding tests for this change is not really an option without potentially affecting other tests.

Follow-up to [51606], [51622], [51626], [51629].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51630


git-svn-id: http://core.svn.wordpress.org/trunk@51236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 22:08:57 +00:00
Sergey Biryukov
1ee5e68a94 Code Modernization: Check the return type of parse_url() on Plugin/Theme Editor screens.
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

While it is probably unlikely that someone would have a direct link to the plugin/theme editor on their home page or even on someone else's homepage, it is entirely possible for the referrer URL to not have a "path" component.

In PHP 8.1, this would lead to a `basename(): Passing null to parameter #1 ($string) of type string is deprecated` notice.

Changing the logic around and adding validation for the return type value of `parse_url()` prevents that.

Follow-up to [51606], [51622], [51626].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51629


git-svn-id: http://core.svn.wordpress.org/trunk@51235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 21:56:58 +00:00
Sergey Biryukov
28e10d9c17 Tests: Move loading the PO class to set_up_before_class().
This ensures that the class is loaded once before the first test of the test case class is run, and `require_once()` is not unnecessarily called for each test method individually.

Follow-up to [1106/tests].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51628


git-svn-id: http://core.svn.wordpress.org/trunk@51234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 20:03:00 +00:00
Sergey Biryukov
912c683b49 Tests: Use a better return type check for parse_url() in do_enclose() tests.
Since the `pathinfo()` function accepts a string, checking for that specifically is more consistent with similar checks elsewhere in core.

Follow-up to [51606], [51622], [51626].

See #53635.
Built from https://develop.svn.wordpress.org/trunk@51627


git-svn-id: http://core.svn.wordpress.org/trunk@51233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 00:29:03 +00:00
Sergey Biryukov
9f222b708a Code Modernization: Check the return type of parse_url() in download_url().
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

This commit adds three unit tests for `download_url()`:

* The first test is "girl-scouting" to make sure that the code up to the point where the error is expected is tested.
* The second test exposed a PHP 8.1 `basename(): Passing null to parameter #1 ($path) of type string is deprecated` error due to the call to `parse_url()` returning `null` when the component requested does not exist in the passed URL.
* The output of the call to `parse_url()` stored in the `$url_path` variable is used in more places in the function logic. The third test exposes a second PHP 8.1 deprecation notice, this time for `substr(): Passing null to parameter #1 ($string) of type string is deprecated`.

This commit also removes duplicate `parse_url()` calls. Neither `$url` nor `$url_filename` are changed between when they are first received/defined and when they are re-used, so there is no need to repeat the function calls.

Follow-up to [51606], [51622].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51626


git-svn-id: http://core.svn.wordpress.org/trunk@51232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 00:16:01 +00:00
Sergey Biryukov
532bd808c9 Code Modernization: Check the input type in validate_file().
This fixes a `preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated` notice on PHP 8.1.

The behavior for `null` and `string` input is covered by the existing `Tests_Functions::test_validate_file()` test.

Effect: Errors down by 238, assertions up by 1920, failures down by 1.

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51625


git-svn-id: http://core.svn.wordpress.org/trunk@51231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 22:53:02 +00:00
Sergey Biryukov
8a98b96f36 Code Modernization: Correct handling of null in wp_parse_str().
This fixes `parse_str(): Passing null to parameter #1 ($string) of type string is deprecated` notices on PHP 8.1, without change in behaviour.

Impact: 311 of the pre-existing tests are affected by this issue.

The PHP native `parse_str()` function expects a string, however, based on the failing tests, it is clear there are functions in WordPress which passes a non-string – including `null` – value to the `wp_parse_str()` function, which would subsequently pass it onto the PHP native function without further input validation.

Most notable offender is the `wp_parse_args()` function which special cases arrays and objects, but passes everything else off to `wp_parse_str()`.

Several ways to fix this issue have been explored, including checking the received value with `is_string()` or `is_scalar()` before passing it off to the PHP native `parse_str()` function.

In the end it was decided against these in favor of a string cast as:
* `is_string()` would significantly change the behavior for anything non-string.
* `is_scalar()` up to a point as well, as it does not take objects with a `__toString()` method into account.

Executing a string cast on the received value before passing it on maintains the pre-existing behavior while still preventing the deprecation notice coming from PHP 8.1.

Reference: [https://www.php.net/manual/en/function.parse-str.php PHP Manual: parse_str()]

Follow-up to [5709].

Props jrf, hellofromTonya, lucatume, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51624


git-svn-id: http://core.svn.wordpress.org/trunk@51230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 22:18:02 +00:00
Sergey Biryukov
864d9e9a35 Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51623


git-svn-id: http://core.svn.wordpress.org/trunk@51229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 21:35:07 +00:00
Sergey Biryukov
5ca2a817ab Code Modernization: Check the return type of parse_url() in WP::parse_request().
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

In this case, `parse_url()` is called with the `PHP_URL_PATH` as `$component`. This will return `null` in the majority of cases, as – exсept for subdirectory-based sites – `home_url()` returns a URL without the trailing slash, like `http://example.org`.

The return value of `parse_url()` was subsequently passed to `trim()`, leading to a `trim(): Passing null to parameter #1 ($string) of type string is deprecated` notice on PHP 8.1.

Fixed by adjusting the logic flow to:
* Only pass the return value of `parse_url()` to follow-on functions if it makes sense, i.e. if it isn't `null`, nor an empty string.
* Preventing calls to `preg_replace()` and `trim()` further down in the function logic flow, when `preg_replace()`/`trim()` would have nothing to do anyhow.

Follow-up to [25617].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51622


git-svn-id: http://core.svn.wordpress.org/trunk@51228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 20:17:57 +00:00
Sergey Biryukov
2ac9f0814d Code Modernization: Check the return type of _get_cron_array() in wp_schedule_event().
This fixes a "Deprecated: Automatic conversion of false to array is deprecated" warning on PHP 8.1.

In `wp_schedule_event()`, the cron info array is retrieved via a call to `_get_cron_array()`, but as the documentation (correctly) states, the return type of that function is `array|false`, where `false` is returned for a virgin site, with no cron jobs scheduled yet.

However, no type check is done on the return value, and the `wp_schedule_event()` function just blindly continues by assigning a value to a subkey of the `$crons` "array".

Fixed by adding validation for the returned value from `_get_cron_array()` and initializing an empty array if `false` was returned.

Reference: [https://developer.wordpress.org/reference/functions/_get_cron_array/ WordPress Developer Resources: _get_cron_array()]

Props jrf, hellofromTonya, lucatume, pbearne, iluy, pedromendonca, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51619


git-svn-id: http://core.svn.wordpress.org/trunk@51225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 15:23:57 +00:00
Sergey Biryukov
a19a2ad8b1 Twenty Twenty: Add support for wa.me links in Social menu.
This ensures that `wa.me` links, currently preferred by WhatsApp, have the same icon as `whatsapp.com` links.

Follow-up to [47243], [51617].

Props sabernhardt, macmanx.
Fixes #50542.
Built from https://develop.svn.wordpress.org/trunk@51618


git-svn-id: http://core.svn.wordpress.org/trunk@51224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 12:54:58 +00:00
Sergey Biryukov
d5ac679247 Twenty Seventeen: Add support for wa.me links in Social Links menu.
This ensures that `wa.me` links, currently preferred by WhatsApp, have the same icon as `whatsapp.com` links.

Follow-up to [48027].

Props sabernhardt, carepsules, dkarfa.
Fixes #51946.
Built from https://develop.svn.wordpress.org/trunk@51617


git-svn-id: http://core.svn.wordpress.org/trunk@51223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 12:51:01 +00:00
Sergey Biryukov
cf4640b46e Docs: Fix typo in the get_block_editor_settings() description.
Follow-up to [50776].

Props tmatsuur, pbearne.
Fixes #53922.
Built from https://develop.svn.wordpress.org/trunk@51611


git-svn-id: http://core.svn.wordpress.org/trunk@51222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-15 12:45:59 +00:00
Sergey Biryukov
b4ea83c22f Upgrade/Install: Use consistent capitalization for "web host" in setup messages.
Follow-up to [8887], [13163].

Props bradparbs, sabernhardt, mukesh27.
Fixes #53926.
Built from https://develop.svn.wordpress.org/trunk@51610


git-svn-id: http://core.svn.wordpress.org/trunk@51221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-14 12:06:59 +00:00
Sergey Biryukov
6b144ab46a Docs: Correct @since version for the wp_parse_str filter.
The filter was introduced along with the `wp_parse_str()` function in WordPress 2.2.1.

Follow-up to [5709], [8662], [26485].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51609


git-svn-id: http://core.svn.wordpress.org/trunk@51220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-13 15:50:58 +00:00
Sergey Biryukov
e68985e506 Tests: Add unit tests for the wp_nonce_ays() function.
Update the `wp_die_handler()` method to pass the response into `WPDieException` so that `expectExceptionCode()` calls work as expected.

Follow-up to [1221/tests], [3934], [4009], [12309].

Props pbearne, jrf, mukesh27.
Fixes #53882.
Built from https://develop.svn.wordpress.org/trunk@51608


git-svn-id: http://core.svn.wordpress.org/trunk@51219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-13 14:02:02 +00:00
Sergey Biryukov
a2a8b77806 Docs: Synchronize documentation for wp_get_attachment_image_attributes filter callbacks in bundled themes:
* Twenty Sixteen: Correct the `$attachment` parameter type, use typed array notation.
* Twenty Seventeen: Correct the `$attachment` parameter type, use typed array notation.
* Twenty Nineteen: Correct the `@return` value type, use typed array notation.
* Twenty Twenty-One: Add missing `@return` value description, use typed array notation.

Follow-up to [29836], [47249], [49021], [49597].

Props ankitmaru, mukesh27, SergeyBiryukov.
Fixes #53878.
Built from https://develop.svn.wordpress.org/trunk@51607


git-svn-id: http://core.svn.wordpress.org/trunk@51218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-12 19:30:57 +00:00
Sergey Biryukov
0984eca703 Tests: Use correct comparison in do_enclose() tests.
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

In this case, `parse_url()` is called with the `PHP_URL_PATH` as `$component`, but the returned value is subsequently checked against `false`.

In other words, this condition would previously always result in `true` and would lead to `null` potentially being passed to the PHP native `pathinfo()` function which expects a string.

On PHP 8.1, this would result in a test failure with a `pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated` error.

Reference: [https://www.php.net/manual/en/function.pathinfo.php PHP Manual: pathinfo()]

Follow-up to [46175].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51606


git-svn-id: http://core.svn.wordpress.org/trunk@51217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-12 17:50:03 +00:00
Sergey Biryukov
e8a395819d Build/Test Tools: Hard deprecate WP_UnitTestCase_Base::checkRequirements().
The `WP_UnitTestCase_Base::checkRequirements()` method calls the `parent::checkRequirements()` method, but this method became `private` in PHPUnit 7.0 via commit  [932238a6a3 sebastianbergmann/phpunit@932238a].

Aside from that, the `TestCase::getAnnotations()` method which is called next is now also removed in PHPUnit 9.5.

WP core does not use the method anymore, and the method only remains to prevent potentially breaking external integration tests relying on the method. However, in effect, the method is not functional anymore in PHPUnit 7.0+.

Follow-up to [893/tests], [894/tests], [896/tests], [918/tests], [30526], [40520], [40564], [43005], [44701], [51559-51577].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51605


git-svn-id: http://core.svn.wordpress.org/trunk@51216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-12 10:34:01 +00:00
Sergey Biryukov
9937fea517 Build/Test Tools: Simplify the PHPUnit test workflow.
This removes the previously duplicated set of test runs specifically for PHP 8.1 in favor of combining `if` conditions for individual test runs with the `continue-on-error` option.

Follow-up to [51588].

Props desrosj, swissspidy, jrf.
Fixes #53891.
Built from https://develop.svn.wordpress.org/trunk@51604


git-svn-id: http://core.svn.wordpress.org/trunk@51215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 15:43:57 +00:00
Sergey Biryukov
c5c6b7de59 Build/Test Tools: Revert [51602] for now to investigate test failures on PHPUnit < 7.0.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51603


git-svn-id: http://core.svn.wordpress.org/trunk@51214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 15:02:58 +00:00
Sergey Biryukov
8f95d5bb91 Build/Test Tools: Hard deprecate WP_UnitTestCase_Base::checkRequirements().
The `WP_UnitTestCase_Base::checkRequirements()` method calls the `parent::checkRequirements()` method, but this method became `private` in PHPUnit 7.0 via commit  [932238a6a3 sebastianbergmann/phpunit@932238a].

Aside from that, the `TestCase::getAnnotations()` method which is called next is now also removed in PHPUnit 9.5.

WP core does not use the method anymore, and the method only remains to prevent potentially breaking external integration tests relying on the method. However, in effect, the method is not functional anymore in PHPUnit 7.0+.

Follow-up to [893/tests], [894/tests], [896/tests], [918/tests], [30526], [40520], [40564], [43005], [44701], [51559-51577].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51602


git-svn-id: http://core.svn.wordpress.org/trunk@51213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 14:31:57 +00:00
Sergey Biryukov
e2a64f0cd2 Themes: Make sure the theme API response is not an error before operating on it in themes_api().
This fixes a potential bug and avoids PHP warnings when `themes_api( 'query_themes' )` is called and a successful API response is not received.

Follow-up to [42632].

Props pierlo.
Fixes #53913.
Built from https://develop.svn.wordpress.org/trunk@51601


git-svn-id: http://core.svn.wordpress.org/trunk@51212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 13:01:56 +00:00
gziolo
bf20ded7d6 Tests: Fix failing i18n unit tests for block metadata
Follow up for #53238.

Changes to the translation file weren't included in [51599].


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


git-svn-id: http://core.svn.wordpress.org/trunk@51211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 10:38:57 +00:00
gziolo
2f6eb9d25e Blocks: Add support for variations in block.json` file
We integrated variations with block types and the corresponding REST API endpoint in #52688. It's a follow-up patch to add missing support to the `block.json` metadata file when using `register_block_type`.

Some fields for variations are translatable.Therefore, i18n schema was copied over from Gutenberg: https://github.com/WordPress/gutenberg/blob/trunk/packages/blocks/src/api/i18n-block.json. The accompanying implementation was adapted as `translate_settings_using_i18n_schema`.

Props: gwwar, swissspidy, schlessera, jorgefilipecosta.
Fixes #53238.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 09:08:01 +00:00
Sergey Biryukov
74c48a1af5 Build/Test Tools: Make the polyfills loading more flexible.
The PHPUnit Polyfills are, since [51559], a required dependency for the WP test suite and, by extension, for plugin/theme integration test suites which are based on and use (parts of) the WP core test suite.

However, plugin/theme integration test suites may not use a full WordPress installation.

This commit:
* Removes the presumption that a full WP install, including `vendor` directory, will be available when the test `bootstrap.php` file is run.
* Makes the loading of the PHPUnit Polyfills autoload file more flexible by:
  * Checking if the autoload class contained within the autoload file is already available before attempting to load the file.[[BR]]
    This allows for plugin/theme integration test suites to load the `phpunitpolyfills-autoload.php` file from any location, as long as it is loaded before the WP core test `bootstrap.php` file is run.
  * Allowing for the path to an arbitrary installation location for the PHPUnit Polyfills to be passed as a constant.[[BR]]
    As long as the provided location is a valid file path and the `phpunitpolyfills-autoload.php` file exists in the provided location, that file will be loaded.[[BR]]
    The constant can be declared in a plugin/theme integration test suite native test bootstrap file, or in the `wp-tests-config.php` file, or even in a `phpunit.xml[.dist]` file via `<php><const name="WP_TESTS_PHPUNIT_POLYFILLS_PATH" value="path/to/yoast/phpunit-polyfills"/></php>`.
* Adds a version check for the PHPUnit Polyfills to prevent a mismatch between the version of the package expected by WordPress and the version used by plugins/themes.[[BR]]
  The version this checks for should be in line with the minimum version requirement for the PHPUnit Polyfills as declared in the `composer.json` file.[[BR]]
  This version number should only be updated when new features added in later PHPUnit Polyfills releases are actually used in the WP core test suite.
* Adds appropriate error messages for every possible error condition.
* Upgrades the PHPUnit Polyfills to version 1.0.1, which now includes a version constant.

Follow-up to [51559-51577].

Props jrf, hellofromTonya, swissspidy, jeherve, thomasplevy, SergeyBiryukov.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51598


git-svn-id: http://core.svn.wordpress.org/trunk@51209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 21:14:56 +00:00
Sergey Biryukov
d8413a32e1 General: Restore (un-deprecate) the sanitize_url() function.
A general security rule is "Sanitize when you save, escape when you echo", and for the most part WordPress has well-named functions like `sanitize_email()` and others, with `esc_url_raw()` being a single exception that does not follow the naming.

This commit restores the previously deprecated `sanitize_url()` function as a valid alias of `esc_url_raw()`.

This better aligns with the naming with other `sanitize_*()` functions:

* `sanitize_bookmark()`
* `sanitize_bookmark_field()`
* `sanitize_category()`
* `sanitize_category_field()`
* `sanitize_comment_cookies()`
* `sanitize_email()`
* `sanitize_file_name()`
* `sanitize_hex_color()`
* `sanitize_hex_color_no_hash()`
* `sanitize_html_class()`
* `sanitize_key()`
* `sanitize_meta()`
* `sanitize_mime_type()`
* `sanitize_option()`
* `sanitize_post()`
* `sanitize_post_field()`
* `sanitize_sql_orderby()`
* `sanitize_term()`
* `sanitize_term_field()`
* `sanitize_text_field()`
* `sanitize_textarea_field()`
* `sanitize_title()`
* `sanitize_title_for_query()`
* `sanitize_title_with_dashes()`
* `sanitize_trackback_urls()`
* `sanitize_user()`
* `sanitize_user_field()`

Follow-up to [11383], [13096].

Props Ipstenu, aadilali.
Fixes #53876.
Built from https://develop.svn.wordpress.org/trunk@51597


git-svn-id: http://core.svn.wordpress.org/trunk@51208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 19:44:59 +00:00
Sergey Biryukov
78e8a3db65 Editor: Preserve the original template keys when preparing a list of page templates.
Previously, the original "404" template key was lost when "Default template" is merged into the available templates array, as the `array_merge()` function renumbers numeric keys. Later, when we merge templates on the client side, this caused duplicate "404" templates to appear in the dropdown.

By replacing the `array_merge()` call with `array_replace()`, we make sure to keep the original numeric keys.

Props Mamaduka, Toro_Unit, youknowriad.
Fixes #53898.
Built from https://develop.svn.wordpress.org/trunk@51595


git-svn-id: http://core.svn.wordpress.org/trunk@51206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 17:56:57 +00:00
Sergey Biryukov
74bef46884 Code Modernization: Silence the deprecation warning for missing return type in phpunit/tests/compat.php.
This fixes the "Deprecated: Return type of `CountableFake::count()` should be compatible with `Countable::count(): int`" warning on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517], [51529], [51530], [51531], [51532].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51594


git-svn-id: http://core.svn.wordpress.org/trunk@51205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 17:35:57 +00:00
Sergey Biryukov
5202ae3852 Docs: Improve documentation for a few functions per the documentation standards.
This affects:
* `checked()`
* `selected()`
* `disabled()`
* `wp_readonly()`
* `readonly()`
* `__checked_selected_helper()`

Follow-up to [143], [560], [9053], [10662], [13658], [41728], [51586].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51592


git-svn-id: http://core.svn.wordpress.org/trunk@51203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 13:45:57 +00:00
Sergey Biryukov
f7dbd99922 Upgrade/Install: Update sodium_compat to v1.17.0.
The latest version of sodium_compat includes fixes for PHP 8.1 compatibility and a fix for PHP 5.6 compatibility.

A full list of changes in this update can be found on GitHub:
https://github.com/paragonie/sodium_compat/compare/v1.16.1...v1.17.0

Follow-up to [49741], [51002].

Props jrf.
Fixes #53907.
Built from https://develop.svn.wordpress.org/trunk@51591


git-svn-id: http://core.svn.wordpress.org/trunk@51202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 13:04:57 +00:00
Sergey Biryukov
16b7e3d44c Docs: Add a @see reference to the xmlrpc_enabled filter in wp_xmlrpc_server::set_is_enabled().
Follow-up to [28065].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51590


git-svn-id: http://core.svn.wordpress.org/trunk@51201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 12:54:56 +00:00
Sergey Biryukov
31c5fc58f2 Docs: Add a @see reference to the wp_mail_content_type filter in wp_staticize_emoji_for_email().
Follow-up to [31860].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51589


git-svn-id: http://core.svn.wordpress.org/trunk@51200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 12:53:59 +00:00
Sergey Biryukov
8e5b18b6f3 Build/Test Tools: Enable running the tests on PHP 8.1.
PHP 8.1 is expected to be released at the end of November 2021.

Enabling the tests to run in CI on PHP 8.1 allows us to get WordPress ready in time.

As an interim measure, while working through the PHP 8.1 issues, separate conditional steps are added to run the tests on PHP 8.1 with the `continue-on-error` option. That allows the test builds to show as "successful" if all non-PHP 8.1 test runs pass.

Follow-up to [51517], [51543], [51545], [51574], [51582], [51586].

Props jrf.
Fixes #53891. See #53635.
Built from https://develop.svn.wordpress.org/trunk@51588


git-svn-id: http://core.svn.wordpress.org/trunk@51199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-09 20:04:56 +00:00
Sergey Biryukov
48b30d2634 Code Modernization: Replace strftime() and gmstrftime() usage in unit tests.
Since PHP 8.1, the `strftime()` and `gmstrftime()` functions are deprecated:

> The `strftime()` and `gmstrftime()` functions exhibit similar issues as `strptime()`, in that the formats they support, as well as their behavior, is platform-dependent. Unlike `strptime()`, these functions are available on Windows, though with a different feature set than on Linux. Musl-based distributions like Alpine do not support timezone-related format specifiers correctly. These functions are also locale-based, and as such may exhibit thread-safety issues.
>
> `date()` or `DateTime::format()` provide portable alternatives, and `IntlDateFormatter::format()` provides a more sophisticated, localization-aware alternative.

Reference: [https://wiki.php.net/rfc/deprecations_php_8_1#strftime_and_gmstrftime PHP RFC: Deprecations for PHP 8.1: strftime() and gmstrftime()]

> The `strftime()` and `gmstrftime()` functions have been deprecated in favor of
> `date()/DateTime::format()` (for locale-independent formatting) or
> `IntlDateFormatter::format()` (for locale-dependent formatting).

Reference: [1cf4fb739f/UPGRADING (L379-L381) PHP 8.1 Upgrade Notes].

Aside from one instance in SimplePie, the `strftime()` and `gmstrftime()` functions are only used within the test suite of WordPress to create formatted timestamps.

As the function is used in test code, this leads to test warnings like this on PHP 8.1:
{{{
Deprecated: Function strftime() is deprecated in path/to/tests/phpunit/tests/canonical/postStatus.php on line 37
}}}

These calls can all be safely converted to use a pattern along the lines of:
{{{#!php
<?php
date_format( date_create( 'time phrase or timestamp' ), $format )
}}}

Other references:
* [https://www.php.net/manual/en/function.strftime.php PHP Manual: strftime()] (for the old format string characters)
* [https://www.php.net/manual/en/datetime.format.php PHP Manual: DateTime::format()] (for the new format string characters)
* [https://www.php.net/manual/en/datetime.construct.php PHP Manual: DateTime::__construct()] (see Example 2 for a Unix timestamp code sample)

Props jrf, SergeyBiryukov.
Fixes #53897.
Built from https://develop.svn.wordpress.org/trunk@51587


git-svn-id: http://core.svn.wordpress.org/trunk@51198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-09 19:09:55 +00:00
Sergey Biryukov
52da9fb6af Code Modernization: Rename the readonly() function to wp_readonly().
Since PHP 8.1, `readonly` is a reserved keyword and cannot be used as a function name.

In order to avoid PHP parser errors, the `readonly()` function was extracted to a separate file and is now only included conditionally on PHP < 8.1.

This commit also:
* Moves the tests for the `__checked_selected_helper()` function and all the related functions to their own file.
* Switches to named data providers. 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.
* Improves the tests in question to make them feature-complete and expand test coverage.

Props jrf, ayeshrajans, haosun, knutsp, swissspidy, SergeyBiryukov.
Fixes #53858.
Built from https://develop.svn.wordpress.org/trunk@51586


git-svn-id: http://core.svn.wordpress.org/trunk@51197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-09 17:21:00 +00:00
Sergey Biryukov
68f7026cde Build/Test Tools: Declare two TestCase classes as abstract.
TestCases which are intended to be extended and not run directly, should be `abstract`.

Follow-up to [763/tests], [30277].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51585


git-svn-id: http://core.svn.wordpress.org/trunk@51196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-09 14:53:14 +00:00
Sergey Biryukov
3ad7f6e9b2 Build/Test Tools: Remove Unicode character from PHPUnit version check message.
Not all CLI tools can handle Unicode characters or non-system specific line endings well, so this type of CLI messaging should always be written with the optimal cross-platform, cross-CLI tool end-user experience in mind.

Follow-up to [51581].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51584


git-svn-id: http://core.svn.wordpress.org/trunk@51195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-09 13:06:07 +00:00
Sergey Biryukov
319f999ed5 Build/Test Tools: Add schema reference to PHPUnit config files.
The current config files validate against the PHPUnit XSD schema for config files for PHPUnit 5.7 – 9.2.

The schema was changed in PHPUnit 9.3, and the `filter` and `logging` settings were deprecated in favor of `coverage` and a different format for `logging`.

This commit explicitly sets the schema against which the files currently validate, for clarity.

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51583


git-svn-id: http://core.svn.wordpress.org/trunk@51194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-09 12:54:13 +00:00
Sergey Biryukov
988c8be693 Code Modernization: Set the MySQLi error reporting off for PHP 8.1.
Prior to PHP 8.1, the default error handling mode was `MYSQLI_REPORT_OFF`. An error in the extension, database, query, or the database connection returned `false` and emitted a PHP warning:
{{{
$mysqli = new mysqli("localhost", "non-existing-user", "", "");

Warning: mysqli::__construct(): (HY000/2002): No connection could be made because the target machine actively refused it in ... on line ...
}}}

From PHP 8.1 and later, the default error mode is set to `MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT`. An error in the extension, database, query, or the database connection throws an exception:
{{{
$mysqli = new mysqli("localhost", "non-existing-user", "", "");

Fatal error: Uncaught mysqli_sql_exception: Connection refused in ...:...
}}}

WordPress has its own error reporting and gracefully handles the database errors by inspecting the error codes. Setting the MySQLi error reporting to off avoids fatal errors due to uncaught exceptions and maintains the current behavior.

References:
* [https://php.watch/versions/8.1/mysqli-error-mode PHP 8.1: MySQLi: Default error mode set to exceptions]
* [https://wiki.php.net/rfc/mysqli_default_errmode PHP RFC: Change Default mysqli Error Mode]

Props ayeshrajans, jrf.
Fixes #52825.
Built from https://develop.svn.wordpress.org/trunk@51582


git-svn-id: http://core.svn.wordpress.org/trunk@51193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-08 14:10:01 +00:00
Sergey Biryukov
adb77d34e1 Build/Test Tools: Fix message display in test bootstrap.
Any messages to the user which are echo-ed out in the test bootstrap will generally display on a command-line interface.

The *nix specific `"\n"` line ending will be ignored on Windows, making the messages less readable.

For new lines in CLI messages, `PHP_EOL` should be used instead.

This was already done in a few places in the script, but not consistently so. Fixed now.

Follow-up to [UT882], [UT890], [44723], [45020], [48592], [49535], [51560].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51581


git-svn-id: http://core.svn.wordpress.org/trunk@51192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 14:47:02 +00:00
Sergey Biryukov
1b25f7ab0c Tests: Use more appropriate assertions in get_themes() tests.
This replaces instances of `assertTrue( is_dir( ... ) )` with `assertDirectoryExists()` to use native PHPUnit functionality.

The `assertDirectoryExists()` method was introduced in PHPUnit 5.6. As the minimum supported PHPUnit version has been raised to PHPUnit 5.7.21, it can now be used.

Follow-up to [51543], [51574], [51579].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51580


git-svn-id: http://core.svn.wordpress.org/trunk@51191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 14:20:01 +00:00
Sergey Biryukov
76bd6651ab Tests: Use more appropriate assertions in get_themes() tests.
This replaces instances of `assertTrue( is_file( ... ) )` followed by `assertTrue( is_readable( ... ) )` with `assertFileIsReadable()` to use native PHPUnit functionality.

The `assertFileIsReadable()` method was introduced in PHPUnit 5.6. As the minimum supported PHPUnit version has been raised to PHPUnit 5.7.21, it can now be used.

Follow-up to [51543], [51574].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51579


git-svn-id: http://core.svn.wordpress.org/trunk@51190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 14:17:01 +00:00
John Blackbourn
72e66e8910 Themes: Correct the documented types for theme mod values.
A theme mod value can be of any type, not just a string.

See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 13:55:04 +00:00
Sergey Biryukov
52137a090b Tests: Remove redundant @requires tags.
As the minimum supported PHPUnit version has been upped to PHPUnit 5.7.21, these `@requires` tags are now redundant.

Follow-up to [51226], [51234], [51559-51576].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51577


git-svn-id: http://core.svn.wordpress.org/trunk@51188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 11:58:02 +00:00
Sergey Biryukov
5b97d53b27 Tests: Replace expectException() for PHP native errors with calls to the dedicated PHPUnit 8.4+ methods.
The old manner of testing these is soft deprecated as of PHPUnit 8.4, hard deprecated as of PHPUnit 9.0 and will be removed in PHPUnit 10.0.

Most calls like this were already replaced in [51563], however, this particular one could not be changed yet due to the mismatch between the PHPUnit version and the PHP version on which the tests were being run. This is fixed now.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.4.3/ChangeLog-8.4.md#840---2019-10-04
* https://github.com/sebastianbergmann/phpunit/issues/3775

Follow-up to [51559-51575].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51576


git-svn-id: http://core.svn.wordpress.org/trunk@51187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 11:54:00 +00:00
Sergey Biryukov
07e0e7b939 Build/Test Tools: Remove the copied-in PHPUnit 9.x MockObject files.
As the version constraints for PHPUnit now allow the tests to be run on PHPUnit 8.x and 9.x, these files are no longer needed.

Follow-up to [48957], [49037], [51544], [51559-51574].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51575


git-svn-id: http://core.svn.wordpress.org/trunk@51186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 11:45:04 +00:00
Sergey Biryukov
4a4f0fcdb9 Build/Test Tools: Loosen the PHPUnit restriction.
**composer.json**:

Remove the PHPUnit dependency in favor of allowing the PHPUnit Polyfills library to manage the supported PHPUnit version. This automatically now widens the supported PHPUnit versions to 5.7.21 to 9.5.8 (current).

Letting the PHPUnit Polyfills handle the version constraints for PHPUnit prevents potential version conflicts in the future, as well as allows WordPress to benefit straight away when a new PHPUnit version would be released and the PHPUnit Polyfills package adds support for that PHPUnit version.

**Test Bootstrap**

Update the supported version number for PHPUnit 5.x, as the minimum PHPUnit 5.x version supported by the PHPUnit Polyfills is PHPUnit 5.7.21, and remove the PHPUnit maximum.

**.gitignore and svn:ignore:**

Add the PHPUnit cache file to the list of files to be ignored.

Since PHPUnit 8, PHPUnit has a built-in caching feature which creates a `.phpunit.result.cache` file. This file should not be committed.

Follow-up to [40536], [40853], [44701], [51559-51573].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51574


git-svn-id: http://core.svn.wordpress.org/trunk@51185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 11:43:01 +00:00
Sergey Biryukov
e169f95434 Build/Test Tools: Remove SpeedTrapListener.
Now that the tests can run PHPUnit cross-version and Composer will be used to install the test suite in CI, we could switch out the local copies of the [https://github.com/johnkary/phpunit-speedtrap PHPUnit speedtrap] package in favor of using the Composer package, which would prevent us having to make the WP local copies of the class compatible with later PHPUnit versions.

The SpeedTrap test listener was introduced to identify slow tests and take action on these to make them faster.

In practice, however, no notable action was ever taken based on the output of the test listener in all the years it was in place.

With that in mind, it was decided to remove the SpeedTrap test listeners without replacement.

If – at a future date – contributors would want to take action to speed up slow tests anyway, they can:
* Either add the package to their local install and use the output they receive locally to identify slow tests.
* Or use the PHPUnit native `@small` annotations in combination with the PHPUnit `PHP_Invoker` package as described in the PHPUnit documentation to [https://phpunit.readthedocs.io/en/stable/risky-tests.html#test-execution-timeout run tests with time limits].

Follow-up to [35214], [35226], [35767], [44701], [51559-51572].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51573


git-svn-id: http://core.svn.wordpress.org/trunk@51184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 11:16:01 +00:00
Sergey Biryukov
84000fed11 Build/Test Tools: Handle removal of TestCase::getAnnotations().
The PHPUnit native `TestCase::getAnnotations()` method is used to check for WP flavored deprecation notices, however, this method was not covered by the backward compatibility promise for PHPUnit (and was annotated as excluded).

The method has been removed as part of an internal refactor in commit [68582043e1 sebastianbergmann/phpunit@6858204], which is included in PHPUnit 9.5.0.

For now, a workaround is put in place, but it is recommended that the WP `expectDeprecated()` method should be reevaluated in a future iteration.

Follow-up to [51559-51571].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51572


git-svn-id: http://core.svn.wordpress.org/trunk@51183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 11:02:02 +00:00
Sergey Biryukov
5286e65fac Tests: Fix tests failing due to assertContains() using strict checking.
Since PHPUnit 8.0.2, the `assertContains()` method, when checking whether a value exists in an array, will do a strict type comparison of the values.

This caused a couple of tests to fail. Using the correct data type in the test fixes that.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* https://github.com/sebastianbergmann/phpunit/issues/3511
* 6205f33595

Follow-up to [51559-51570].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51571


git-svn-id: http://core.svn.wordpress.org/trunk@51182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 10:53:00 +00:00
Sergey Biryukov
e60dde514b Build/Test Tools: Alias the Getopt class conditionally, as the class no longer exists in PHPUnit 9.x.
Most of the aliasing in this `compat.php` file is redundant as PHPUnit 5.7.21+ contains a forward compatibility layer for these classes anyway (= PHPUnit provides both the namespaced and underscore named versions of these classes in PHPUnit 5.7.21+).

All the same, the file and the aliases are left in place for the time being, as plugins/themes using the WP test suite as the basis for their integration tests may rely on it, though WP itself should not really need it anymore, save for maybe one or two classes.

Follow-up to [51559-51569].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51570


git-svn-id: http://core.svn.wordpress.org/trunk@51181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 10:48:00 +00:00
Sergey Biryukov
f11a7eb1fc Tests: Remove use of assertArraySubset() in Test_WP_Widget_Media::test_constructor().
The `assertArraySubset()` method has been deprecated in PHPUnit 8 and removed in PHPUnit 9.

This replaces the assertions with looping through the array and testing both the key and the value individually.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#800---2019-02-01
* https://github.com/sebastianbergmann/phpunit/issues/3494

Note: There is a polyfill package available for the removed assertion: `dms/phpunit-arraysubset-asserts`, but as the assertion was only used in this one test method, adding this seems redundant.

Follow-up to [51559-51568].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51569


git-svn-id: http://core.svn.wordpress.org/trunk@51180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 10:42:02 +00:00
Sergey Biryukov
5b28064545 Build/Test Tools: Implement use of the void solution.
> PHPUnit 8.0.0 introduced a `void` return type declaration to the "fixture" methods – `setUpBeforeClass()`, `setUp()`, `tearDown()` and `tearDownAfterClass()`. As the `void` return type was not introduced until PHP 7.1, this makes it more difficult to create cross-version compatible tests when using fixtures, due to signature mismatches.
>
> The `Yoast\PHPUnitPolyfills\TestCases\TestCase` overcomes the signature mismatch by having two versions. The correct one will be loaded depending on the PHPUnit version being used.
>
> When using this TestCase, if an individual test, or another TestCase which extends this TestCase, needs to overload any of the "fixture" methods, it should do so by using a snake_case variant of the original fixture method name, i.e. `set_up_before_class()`, `set_up()`, `assert_pre_conditions()`, `assert_post_conditions()`, `tear_down()`, and `tear_down_after_class()`.
>
> The snake_case methods will automatically be called by PHPUnit.
>
> > IMPORTANT: The snake_case methods should not call the PHPUnit parent, i.e. do not use `parent::setUp()` from within an overloaded `set_up()` method. If necessary, DO call `parent::set_up()`.

Reference: https://github.com/Yoast/PHPUnit-Polyfills#testcases

This commit renames all declared fixture methods, and calls to parent versions of those fixture methods, from camelCase to snake_case.

Follow-up to [51559-51567].

Props jrf, hellofromTonya, johnbillion, netweb, dd32, pputzer, SergeyBiryukov.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51568


git-svn-id: http://core.svn.wordpress.org/trunk@51179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 10:31:02 +00:00
Sergey Biryukov
6d15c09bf9 Build/Test Tools: Use the PHPUnit Polyfill TestCase as void workaround.
> PHPUnit 8.0.0 introduced a `void` return type declaration to the "fixture" methods – `setUpBeforeClass()`, `setUp()`, `tearDown()` and `tearDownAfterClass()`. As the `void` return type was not introduced until PHP 7.1, this makes it more difficult to create cross-version compatible tests when using fixtures, due to signature mismatches.
>
> The `Yoast\PHPUnitPolyfills\TestCases\TestCase` overcomes the signature mismatch by having two versions. The correct one will be loaded depending on the PHPUnit version being used.
>
> When using this TestCase, if an individual test, or another TestCase which extends this TestCase, needs to overload any of the "fixture" methods, it should do so by using a snake_case variant of the original fixture method name, i.e. `set_up_before_class()`, `set_up()`, `assert_pre_conditions()`, `assert_post_conditions()`, `tear_down()`, and `tear_down_after_class()`.
>
> The snake_case methods will automatically be called by PHPUnit.
>
> > IMPORTANT: The snake_case methods should not call the PHPUnit parent, i.e. do not use `parent::setUp()` from within an overloaded `set_up()` method. If necessary, DO call `parent::set_up()`.

Reference: https://github.com/Yoast/PHPUnit-Polyfills#testcases

This commit:
* Lets the `PHPUnit_Adapter_TestCase` extend the `Yoast\PHPUnitPolyfills\TestCases\TestCase`, which makes this solution for the `void` return type available to the WordPress test suite.
* Removes the individual import and trait `use` statements for the Polyfill traits. These are no longer necessary as the `Yoast\PHPUnitPolyfills\TestCases\TestCase` already includes those.

Follow-up to [51559-51566].

Props jrf, hellofromTonya, johnbillion, netweb, SergeyBiryukov.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51567


git-svn-id: http://core.svn.wordpress.org/trunk@51178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-07 10:22:02 +00:00
Sergey Biryukov
ab110d5206 Tests: Replace assertNotRegExp() with assertDoesNotMatchRegularExpression().
The `assertRegExp()` and `assertNotRegExp()` methods were hard deprecated in PHPUnit 9.1 and the functionality will be removed in PHPUnit 10.0.

The `assertMatchesRegularExpression()` and `assertDoesNotMatchRegularExpression()` methods were introduced as a replacement in PHPUnit 9.1.

These new PHPUnit methods are polyfilled by the PHPUnit Polyfills and switching to them will future-proof the tests some more.

References:
* https://github.com/sebastianbergmann/phpunit/blob/9.1.5/ChangeLog-9.1.md#910---2020-04-03
* https://github.com/sebastianbergmann/phpunit/issues/4085
* https://github.com/sebastianbergmann/phpunit/issues/4088

Follow-up to [51559-51565].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51566


git-svn-id: http://core.svn.wordpress.org/trunk@51177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-06 21:56:57 +00:00
Sergey Biryukov
0aacd6abfd Tests: Replace assertRegExp() with assertMatchesRegularExpression().
The `assertRegExp()` and `assertNotRegExp()` methods were hard deprecated in PHPUnit 9.1 and the functionality will be removed in PHPUnit 10.0.

The `assertMatchesRegularExpression()` and `assertDoesNotMatchRegularExpression()` methods were introduced as a replacement in PHPUnit 9.1.

These new PHPUnit methods are polyfilled by the PHPUnit Polyfills and switching to them will future-proof the tests some more.

References:
* https://github.com/sebastianbergmann/phpunit/blob/9.1.5/ChangeLog-9.1.md#910---2020-04-03
* https://github.com/sebastianbergmann/phpunit/issues/4085
* https://github.com/sebastianbergmann/phpunit/issues/4088

Follow-up to [51559-51564].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51565


git-svn-id: http://core.svn.wordpress.org/trunk@51176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-06 21:53:57 +00:00
Sergey Biryukov
549857fa3b Tests: Replace assertFileNotExists() with assertFileDoesNotExist().
The `assertFileNotExists()` method was hard deprecated in PHPUnit 9.1 and the functionality will be removed in PHPUnit 10.0.

The `assertFileDoesNotExist()` method was introduced as a replacement in PHPUnit 9.1.

This new PHPUnit method is polyfilled by the PHPUnit Polyfills and switching to it will future-proof the tests some more.

References:
* https://github.com/sebastianbergmann/phpunit/blob/9.1.5/ChangeLog-9.1.md#910---2020-04-03
* https://github.com/sebastianbergmann/phpunit/issues/4076

Follow-up to [51559-51563].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51564


git-svn-id: http://core.svn.wordpress.org/trunk@51175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-06 21:46:55 +00:00
Sergey Biryukov
9a8caf2eba Tests: Replace expectException() for PHP native errors with calls to the dedicated PHPUnit 8.4+ methods.
The old manner of testing these is soft deprecated as of PHPUnit 8.4, hard deprecated as of PHPUnit 9.0 and will be removed in PHPUnit 10.0.

These dedicated methods introduced in PHPUnit 8.4 should be used as an alternative:

* `expectDeprecation()`
* `expectDeprecationMessage()`
* `expectDeprecationMessageMatches()`
* `expectNotice()`
* `expectNoticeMessage()`
* `expectNoticeMessageMatches()`
* `expectWarning()`
* `expectWarningMessage()`
* `expectWarningMessageMatches()`
* `expectError()`
* `expectErrorMessage()`
* `expectErrorMessageMatches()`

These new PHPUnit methods are all polyfilled by the PHPUnit Polyfills and switching to these will future-proof the tests some more.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.4.3/ChangeLog-8.4.md#840---2019-10-04
* https://github.com/sebastianbergmann/phpunit/issues/3775

Follow-up to [51559-51562].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51563


git-svn-id: http://core.svn.wordpress.org/trunk@51174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-06 21:39:58 +00:00
Sergey Biryukov
23383ec51c Build/Test Tools: Simplify redundant PHPUnit shim for setExpectedException().
PHPUnit 6 deprecated the `setExpectedException()` method in favor of the `expectException()`, `expectExceptionMessage()`, and `expectExceptionCode()` methods.

`WP_UnitTestCase_Base::setExpectedException()` backfilled the old method. As the PHPUnit Polyfills have a polyfill for the ''new'' method, this backfill can now be simplified.

This backfill ''should'' be removed in a future iteration, but is, for now, left in place so as not to break backward compatibility for plugin/theme test suites which extend the WP native test suite for their integration tests.

Follow-up to [48996], [48997], [51559-51561].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51562


git-svn-id: http://core.svn.wordpress.org/trunk@51173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-06 21:19:02 +00:00
Sergey Biryukov
46ef4c1f7b Build/Test Tools: Change the inheritance order of the abstract test classes.
As things were, the inheritance order of the abstract test classes was as follows:
{{{
WP_UnitTestCase (PHPUnit adapter layer)
    extends WP_UnitTestCase_Base (base test class)
        extends PHPUnit\Framework\TestCase (PHPUnit native class)
}}}

Concrete (child) test classes, as well as more specific abstract TestCases, are/were expected to extend the `WP_UnitTestCase`.

This order is not optimal as it means that the `WP_UnitTestCase_Base` class would not be able to benefit from any polyfills and/or shims in the PHPUnit adapter layer.

With that in mind, this commit changes the inheritance to:
{{{
WP_UnitTestCase (empty class, left in place to not break BC for plugin/theme integration tests)
    extends WP_UnitTestCase_Base (base test class)
        extends PHPUnit_Adapter_TestCase (PHPUnit adapter layer)
            extends PHPUnit\Framework\TestCase (PHPUnit native class)
}}}

The new order allows for the `WP_UnitTestCase_Base` to also benefit from the PHPUnit adapter layer.

For backward compatibility reasons the `WP_UnitTestCase`, which all test classes are (were) expected to extend, is left in place, though it is now an empty class and explicitly `abstract`.

Follow-up to [51559], [51560].

Props jrf, hellofromTonya, johnbillion, netweb, SergeyBiryukov.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51561


git-svn-id: http://core.svn.wordpress.org/trunk@51172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-06 00:44:57 +00:00
Sergey Biryukov
afea9cfbd6 Build/Test Tools: Unify the PHPUnit adapter TestCases.
This commit:
* Removes the PHPUnit 7 specific `TestCase`.
* Removes all existing polyfills from the PHPUnit 5.x `TestCase`.
* Imports all polyfill traits from the PHPUnit Polyfills package into the `WP_UnitTestCase` class and updates the DocBlock to reflect the actual function of the class.
 * Note: The list of polyfills needs to be verified and updated after each new release of the PHPUnit Polyfills package. Alternatively (recommended), one of the built-in `TestCase` classes from the PHPUnit Polyfills package can be used instead.

* Moves the `require` for the WP `abstract-testcase.php` to the `bootstrap.php` file.
* Adds a `require_once` for the PHPUnit Polyfills autoloader to the `bootstrap.php` file.
 * Note: while this isn't _strictly_ necessary when the tests are run via Composer, having the include in the bootstrap allows for the tests to also be run via a PHPUnit Phar, providing contributors with more flexibility.

Follow-up to [51559].

Props jrf, hellofromTonya, johnbillion, netweb, SergeyBiryukov.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51560


git-svn-id: http://core.svn.wordpress.org/trunk@51171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-06 00:36:56 +00:00
Sergey Biryukov
b39d6ce7ad Build/Test Tools: Add Composer dependency on the PHPUnit Polyfills package.
The PHPUnit Polyfills package is an add-on for PHPUnit, which works around common issues for writing PHPUnit cross-version compatible tests.

Features:
* It offers a full set of polyfills for assertions and expectations introduced in PHPUnit since PHPUnit 4.8.
* It offers two generic TestCases which include these polyfills, but also solve the `void` return type issue for the fixtures methods.
* It offers a PHPUnit cross-version solution for the changes to the PHPUnit `TestListener` implementation.
* Supports PHPUnit 4.8 – current.
* Supports and is compatible with PHP 5.4 – current.

The package has no outside dependencies, other than PHPUnit, is actively maintained and endorsed by the maintainer of PHPUnit itself (the only package of its kind which has ever been endorsed).

Props jrf, hellofromTonya, johnbillion, netweb, SergeyBiryukov.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51559


git-svn-id: http://core.svn.wordpress.org/trunk@51170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-06 00:34:58 +00:00
desrosj
fa93063ac1 Build/Test Tools: Add branch filtering for Slack notifications workflow.
Since branch filtering happens prior to the workflow run being created, filtering the branches that `workflow_run` will fire on for this workflow should cut down on the number of skipped “Slack Notifications” runs listed in the Actions section of the repository.

This also removes the check for a `skipped` outcome in the requesting workflow. Workflows for push events resulting from WordPress Core commits are never skipped.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51558


git-svn-id: http://core.svn.wordpress.org/trunk@51169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 16:53:55 +00:00
Sergey Biryukov
04f4e911dc Coding Standards: Silence a WPCS warning in date_i18n().
This fixes a "Calling `current_time()` with a `$type` of `timestamp` or `U` is strongly discouraged as it will not return a Unix (UTC) timestamp" warning.

Props jrf.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51557


git-svn-id: http://core.svn.wordpress.org/trunk@51168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 14:49:57 +00:00
Sergey Biryukov
62a788e40e Twenty Thirteen: Correct indentation in image.php template.
Props jrf.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51556


git-svn-id: http://core.svn.wordpress.org/trunk@51167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 14:38:57 +00:00
desrosj
3560a816d5 Build/Test Tools: Correctly check for the trigger event when running the Slack notifications workflow.
This updates the conditional check for the Slack notifications workflow to check the event of the original workflow and not the one requested through the `workflow_run:completed` event.

The run triggering the event is accessible at `github.event.workflow_run`.

Props Clorith.
See #52644.
Built from https://develop.svn.wordpress.org/trunk@51555


git-svn-id: http://core.svn.wordpress.org/trunk@51166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 14:37:56 +00:00
Sergey Biryukov
ee4be502a7 Twenty Thirteen: Remove wrapping HTML tag from translatable string.
This fixes a "Strings should not be wrapped in HTML" WPCS warning.

Props jrf.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51554


git-svn-id: http://core.svn.wordpress.org/trunk@51165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 14:36:57 +00:00
Sergey Biryukov
64b193980a Bundled Themes: Remove redundant semicolons after closing curly brackets.
Includes a few minor indentation fixes.

Props jrf.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51553


git-svn-id: http://core.svn.wordpress.org/trunk@51164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 13:25:58 +00:00
Sergey Biryukov
815e31f611 Coding Standards: Remove redundant semicolons after closing curly brackets.
Props jrf.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51552


git-svn-id: http://core.svn.wordpress.org/trunk@51163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 13:15:55 +00:00
Sergey Biryukov
d289b7f602 Coding Standards: Fix incorrect alignment in two comment blocks.
Tabs should only be used for indentation and not for mid-line alignment.

Props jrf.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51551


git-svn-id: http://core.svn.wordpress.org/trunk@51162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 13:11:56 +00:00
Sergey Biryukov
72acd346a2 Coding Standards: Fix incorrect comment indent in safecss_filter_attr().
Props jrf.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51550


git-svn-id: http://core.svn.wordpress.org/trunk@51161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 12:59:58 +00:00
Peter Wilson
73be6fd8ef Coding Standards: Use strict comparisons in wp-admin/upload.php.
See #53359.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 03:37:56 +00:00
Peter Wilson
c1d05d5085 Coding Standards: Use strict comparisons in wp-admin/options-discussion.php.
See #53359.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 03:30:57 +00:00
Sergey Biryukov
318fc1fcc9 Build/Test Tools: Switch to always running the tests via Composer.
Previously the tests were run via a PHPUnit Phar file for PHP 5.6–7.4, with PHP 8.0 using a Composer-installed version of PHPUnit.

Running the tests via a Phar without the need for a `composer install` is (marginally) faster in overall build time, however, this commit is part of a larger chain of changes which will make the test suite PHPUnit cross-version compatible.

With an eye on those upcoming changes, which will allow us to run the tests on the most appropriate PHPUnit version for each supported PHP version, it is opportune to switch to using a Composer-installed version of PHPUnit for all PHP versions supported by WordPress. Previously this was not possible without additional conditional `update` commands being run, due to the `composer.lock` file being in place and being locked at PHPUnit 7.5.20.

Switching over to using the Composer-installed PHPUnit version, with that PHPUnit version adjusting based on the PHP version, allows for some minor simplifications in the GitHub Actions script.

This means we need additional measures to make sure that the Composer cache file does not go too far out of date as that would significantly slow down the builds.

By adding a "Last Monday" date to the cache key, in combination with the pre-existing OS, PHP version and the hash of the `composer.json` file, we can guarantee that:
1. There will be a cache created for each OS/PHP combination.
2. These caches will be replaced whenever a change is made to the `composer.json` file.
3. These caches will be replaced every Monday of each week ensuring that the cache file does not go too far out of date.

Note: The NPM script `test:php` is now no longer needed during the builds. However, to prevent breaking the workflow of contributors who may be used to having the command available, the command remains available.

In a future iteration we may be able to replace the caching of the Composer dependencies with the Composer cache action as offered on the GitHub marketplace, which would further simplify the script.

Follow-up to [42960], [46290], [47881], [48957], [49037], [51543], [51544].

Props jrf, desrosj.
Fixes #47381.
Built from https://develop.svn.wordpress.org/trunk@51545


git-svn-id: http://core.svn.wordpress.org/trunk@51156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-04 19:49:56 +00:00
Sergey Biryukov
3db37d3459 Build/Test Tools: Use a custom autoloader for the PHPUnit 9.x mock object classes.
This prevents the classes from being loaded automatically via the `autoload-dev` directives when a Composer-installed PHPUnit 5.x or 6.x version is used, as that would break the test run.

It is expected that this autoloader will be removed soon, as it should no longer be needed when the PHPUnit version constraints are widened.

Notes:
* The autoloader file will be loaded from the Test bootstrap.
* The autoloader will always be registered and directed to queue itself _before_ the Composer autoload file (which will already have been registered).
* The autoloader will only actually load the WP copies of the files/classes when PHP 8.0 in combination with PHPUnit 7.x is detected. In all other cases, the autoloader will bow out, which effectively then defers to the Composer autoload file to load the files as shipped with the installed PHPUnit version.

Follow-up to [48957], [49037], [51543].

Props jrf.
See #47381.
Built from https://develop.svn.wordpress.org/trunk@51544


git-svn-id: http://core.svn.wordpress.org/trunk@51155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-04 19:26:00 +00:00
Sergey Biryukov
6e4d0d8f48 Build/Test Tools: Remove the Composer lock file from version control.
This makes it easier to run unit tests against multiple different PHP versions.

There is currently no reason to have a `composer.lock` file as:

* External runtime dependencies are not managed via Composer.
* Managed updates of the non-runtime dependencies can be done by locking the version used in the `composer.json` file to a precise version instead of using a `composer.lock` file.
* Having the `composer.lock` file in place makes it a lot more difficult to run the tests against all supported PHP versions.

With these considerations in mind, the lock file is now removed from version control and added to `.gitignore` and `svn:ignore`.

Version constraints for the current dev dependencies are adjusted accordingly:

* PHPUnit now explicitly declares in its version constraints that PHPUnit 5.x, 6.x, and 7.x are supported. The minimum supported version for PHPUnit 5.x has been raised from 5.4 to 5.7, which in practice was already the version used for running the tests on PHP 5.6.
* PHPCompatibilityWP is effectively updated to version 2.1.2 with the positive impact that a few new constants polyfilled in WP 5.8 are now accounted for (excluded from being flagged).
* PHP_CodeSniffer is declared as an explicit dependency to ensure that updates to it will always be explicitly managed instead of inherited.
* The DealerDirect Composer plugin is effectively updated to version 0.7.1 without impact.

Follow-up to [42960], [46290], [47881], [48957].

Props jrf, johnbillion, desrosj, ayeshrajans, aristath, hellofromTonya, SergeyBiryukov.
See #47381.
Built from https://develop.svn.wordpress.org/trunk@51543


git-svn-id: http://core.svn.wordpress.org/trunk@51154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-04 18:57:00 +00:00
Sergey Biryukov
8f994d84de Media: Add / character to <img> tag in wp_print_media_templates().
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.

Follow-up to [47493], [48834], [50556], [51473], [51541].

Props shital-patel, akabarikalpesh.
Fixes #53870.
Built from https://develop.svn.wordpress.org/trunk@51542


git-svn-id: http://core.svn.wordpress.org/trunk@51153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-04 14:25:58 +00:00
Sergey Biryukov
0be77d4ebf Bundled Themes: Add / character to <img> tags.
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.

Follow-up to [47493], [48834], [50556], [51473].

Props shital-patel, akabarikalpesh.
See #53870.
Built from https://develop.svn.wordpress.org/trunk@51541


git-svn-id: http://core.svn.wordpress.org/trunk@51152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-04 14:24:02 +00:00
Peter Wilson
67119713fc Editor: Prevent block-editor JavaScript loading in other editors.
Add a check to `wp_add_iframed_editor_assets_html()` confirming the edit post screen is using the block-editor before including block-editor specific JavaScript. For the classic and other editors the function returns early without any output.

Props swissspidy, desrosj.
Fixes #53696.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-04 05:10:56 +00:00
Peter Wilson
7829821c62 Menus: Hide bulk-select on new menu page.
Prevent the bulk-select option from displaying when adding a new menu. This also prevents the option from displaying when an administrator first visits the menu page and no menus are set.

Props dlh, sabernhardt.
Fixes #53654.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-04 05:00:59 +00:00
jorgefilipecosta
eff1c81de6 Block Editor: Add missing border setting on button block.
This commit fixes a regression on WordPress 5.8 that made the border radius setting on the buttons block disappear.

Props Mamaduka, daisyo, priethor, desrosj, mikeschroder.
Fixes #53702.
Built from https://develop.svn.wordpress.org/trunk@51538


git-svn-id: http://core.svn.wordpress.org/trunk@51149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 18:14:58 +00:00
desrosj
cf0f278ebe Build/Test Tools: Revert changes only included for testing purposes.
Follow up to [51535-51536].

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51537


git-svn-id: http://core.svn.wordpress.org/trunk@51148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 15:15:57 +00:00
desrosj
f45ed61786 Build/Test Tools: Correct invalid JSON in Slack payload.
The outer `”` marks are not required and produce invalid JSON.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51536


git-svn-id: http://core.svn.wordpress.org/trunk@51147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 15:08:56 +00:00
desrosj
a748075471 Build/Test Tools: Expand Slack notifications for GitHub Actions.
This expands Slack notifications to include success, cancelled, and “fixed” GitHub Action workflow run outcomes in addition to failures.

A “fixed” outcome occurs when the previous run for a workflow failed and the current one succeeds. This matches the behavior that was native to TravisCI by setting `on_success` for notifications to `change`.

The message details and where each outcome is posted is controlled by Slack workflows.

The Slack notification logic has also been pulled into a separate workflow to prevent repeating code in every workflow.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51535


git-svn-id: http://core.svn.wordpress.org/trunk@51146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 13:46:56 +00:00
Sergey Biryukov
def9fc3741 Coding Standards: Correct DateTimeZone class name in WP_Customize_Date_Time_Control::get_timezone_info().
Follow-up to [41626].

See #53359.
Built from https://develop.svn.wordpress.org/trunk@51534


git-svn-id: http://core.svn.wordpress.org/trunk@51145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 12:18:57 +00:00
Sergey Biryukov
5400c50367 Code Modernization: Pass correct default value to new DateTime() in wp_default_packages_inline_scripts().
This fixes a "Deprecated: `DateTime::__construct()`: Passing null to parameter #1 (`$datetime`) of type string is deprecated" warning on PHP 8.1.

Follow-up to [49083].

See #53635.
Built from https://develop.svn.wordpress.org/trunk@51533


git-svn-id: http://core.svn.wordpress.org/trunk@51144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 12:04:58 +00:00
Sergey Biryukov
fedcc33d27 Code Modernization: Silence the deprecation warnings for missing return type in WP_Block_List.
This fixes the "Deprecated: Return type of `WP_Block_List::[METHODNAME]()` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517], [51529], [51530], [51531].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51532


git-svn-id: http://core.svn.wordpress.org/trunk@51143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 11:12:55 +00:00
Sergey Biryukov
68ba315d9a Code Modernization: Silence the deprecation warnings for missing return type in WP_REST_Request.
This fixes the "Deprecated: Return type of `WP_REST_Request::[METHODNAME]($offset)` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517], [51529], [51530].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51531


git-svn-id: http://core.svn.wordpress.org/trunk@51142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 11:08:56 +00:00
Sergey Biryukov
85c1413c2b Code Modernization: Silence the deprecation warnings for missing return type in WP_Hook.
This fixes the "Deprecated: Return type of `WP_Hook::[METHODNAME]()` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517], [51529].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51530


git-svn-id: http://core.svn.wordpress.org/trunk@51141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-03 11:02:00 +00:00
Sergey Biryukov
3c14324dc6 Code Modernization: Silence the deprecation warnings for missing return type in WP_Theme.
This fixes the "Deprecated: Return type of `WP_Theme::[METHODNAME]($offset)` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51529


git-svn-id: http://core.svn.wordpress.org/trunk@51140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-02 22:31:56 +00:00
Sergey Biryukov
9a4280c75f Upgrade/Install: Store correct result when bulk updating plugins or themes.
This ensures that when multiple plugins or themes are updated and one succeeds and another fails, the error is reported accordingly.

Previously, both updates would end up treated as a success, due to `$this->result` containing the result of the previous operation and not the current one.

Follow-up to [12097].

Props pwtyler, afragen.
Fixes #53002.
Built from https://develop.svn.wordpress.org/trunk@51528


git-svn-id: http://core.svn.wordpress.org/trunk@51139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-02 20:55:56 +00:00
Sergey Biryukov
b186e19855 Docs: Fix typo in the WP_Upgrader::install_package() description.
Follow-up to [30758].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51527


git-svn-id: http://core.svn.wordpress.org/trunk@51138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-02 18:27:57 +00:00
Sergey Biryukov
2e707307d9 Coding Standards: Fix typo in the JS function name for handling the password reset button.
Follow-up to [50129].

See #53359.
Built from https://develop.svn.wordpress.org/trunk@51526


git-svn-id: http://core.svn.wordpress.org/trunk@51137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-02 16:48:57 +00:00
Sergey Biryukov
47fc56d650 Upgrade/Install: Avoid creating nonce during installation.
This avoids a "Table `wp_options` doesn't exist" database error when trying to create a nonce for password reset button.

When installing and using database-saved salts, `wp_create_nonce()` causes database errors as `wp_salt()` attempts to insert into the not-yet-created options table. Since authentication is not available during installation, we can safely skip creating a nonce.

Follow-up to [39684], [50129].

Props schlessera, swissspidy, sanketchodavadiya, hellofromTonya, SergeyBiryukov.
Fixes #53830.
Built from https://develop.svn.wordpress.org/trunk@51525


git-svn-id: http://core.svn.wordpress.org/trunk@51136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-02 16:39:00 +00:00
Sergey Biryukov
9e33977bc9 Themes: Make sure get_theme_mods() always returns an array.
This avoids a "Cannot access offset of type string on string" fatal error in `set_theme_mod()` on PHP 8 if the `theme_mods_$theme_slug` option has an incorrect value, e.g. an empty string instead of an array.

With this change, `set_theme_mod()` should be able to resolve the issue by saving a correct value.

Follow-up to [15736], [15739], [30672], [32629], [32632].

Props xknown.
See #51423.
Built from https://develop.svn.wordpress.org/trunk@51524


git-svn-id: http://core.svn.wordpress.org/trunk@51135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-01 14:55:56 +00:00
Sergey Biryukov
963dd5f06d Docs: Document the $wpdb global in WP_Debug_Data::get_mysql_var().
Follow-up to [51522].

See #53845.
Built from https://develop.svn.wordpress.org/trunk@51523


git-svn-id: http://core.svn.wordpress.org/trunk@51134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-01 14:04:56 +00:00
Sergey Biryukov
2a0191b901 Site Health: Add some more MySQL information to the Site Health Info screen.
This adds three values to the debug info in the Database section:

* Max allowed packet size
* Max connections number
* Query cache size

Props zodiac1978, donmhico, mukesh27, SergeyBiryukov.
Fixes #53845.
Built from https://develop.svn.wordpress.org/trunk@51522


git-svn-id: http://core.svn.wordpress.org/trunk@51133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-01 14:02:00 +00:00
Sergey Biryukov
aa0ed0fcdd Upgrade/Install: Skip any node_modules directories when removing Genericons example.html files on update.
This can significantly reduce the time required to complete the process in a development environment.

Follow-up to [32386].

Props bobbingwide, afragen, desrosj, SergeyBiryukov.
Fixes #52765.
Built from https://develop.svn.wordpress.org/trunk@51521


git-svn-id: http://core.svn.wordpress.org/trunk@51132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-31 10:32:56 +00:00
Sergey Biryukov
4889679ca5 Taxonomy: Pass correct default value for $post_id to wp_terms_checklist() in the posts list table.
This matches the documented type of the `$post_id` argument and is consistent with other instances of `wp_terms_checklist()` calls.

Per the function documentation, the default value is integer `0`, not `null`.

Follow-up to [13535].

Props tareiking, donmhico, jrf.
Fixes #43639.
Built from https://develop.svn.wordpress.org/trunk@51520


git-svn-id: http://core.svn.wordpress.org/trunk@51131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-31 09:50:57 +00:00
John Blackbourn
8935467410 Site Health: Standardise site health check status message punctuation.
Fixes #53594

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


git-svn-id: http://core.svn.wordpress.org/trunk@51130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-30 19:38:57 +00:00
John Blackbourn
2cb4ebefe2 Docs: Replace $this in hook param docs with more appropriate names.
`$this` is a pseudo-variable that cannot be used as the name of a function parameter, so renaming these helps prevent errors when implementing hook callback functions.

Fixes #53457

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


git-svn-id: http://core.svn.wordpress.org/trunk@51129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-30 19:35:58 +00:00
Sergey Biryukov
166dc3ac8e Code Modernization: Fix "JsonSerializable_Object::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed" error on PHP 8.1.
This relates to the [https://wiki.php.net/rfc/internal_method_return_types Return types for internal methods RFC] in PHP 8.1 and in particular, the change made in [https://github.com/php/php-src/pull/7051 PHP PR #7051], which adds a `mixed` return type to the `JsonSerializable::jsonSerialize()` interface method.

WordPress only contains one (test) class which implements the `JsonSerializable` interface and this commit fixes the issue for that class.

As of PHP 8.1, the `jsonSerialize()` method in classes which implement the `JsonSerializable` interface are expected to have a return type declared. The return type should be `mixed` or a more specific type. This complies with the Liskov principle of covariance, which allows the return type of a child overloaded method to be more specific than that of the parent.

The problem with this is that:
1. The `mixed` return type was only introduced in PHP 8.0.
2. Return types in general were only introduced in PHP 7.0.

WordPress still has a minimum PHP version of 5.6, so adding the return type is not feasible for the time being.

The solution chosen for now is to add an attribute to silence the deprecation warning. While attributes are a PHP 8.0+ feature, due to the choice of the `#[]` syntax, in PHP < 8.0, attributes will just be ignored and treated as comments, so there is no drawback to using the attribute.

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51517


git-svn-id: http://core.svn.wordpress.org/trunk@51128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-30 14:47:57 +00:00
John Blackbourn
a4bdae8122 Docs: Add missing documentation for the minute parameter of WP_Query.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-30 10:53:58 +00:00
John Blackbourn
ab9ed33f1d Docs: Correct the documented allowed range for the minute and second parameters of WP_Query.
These are correctly documented and validated in `WP_Date_Query` as 0-59.

See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-30 10:23:57 +00:00
desrosj
9d6ea69d92 Build/Test Tools: Revert the test and coding standards changes in [51511].
These were temporary for testing Slack messages when GitHub Action workflows fail.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51512


git-svn-id: http://core.svn.wordpress.org/trunk@51123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-29 20:03:57 +00:00
desrosj
b5d09ecd99 Build/Test Tools: Post a message to #core in Slack when a workflow fails.
This adds an additional step to each GitHub Action workflow file that posts a message to #core in Slack every time a workflow run fails.

A minor test and spacing change is included in this commit in order to that messages are posted correctly and will be reverted after testing.

See #52644.
Built from https://develop.svn.wordpress.org/trunk@51511


git-svn-id: http://core.svn.wordpress.org/trunk@51122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-29 19:48:58 +00:00
Sergey Biryukov
ec25d0aad3 Themes: Add "Template Editing" to the list of WordPress theme features.
Follow-up to [meta11158].

Props poena, desrosj.
Fixes #53556. See #meta5802.
Built from https://develop.svn.wordpress.org/trunk@51510


git-svn-id: http://core.svn.wordpress.org/trunk@51121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-29 14:48:00 +00:00
gziolo
327852393a Build: Split packages and blocks to their webpack configs
It aligns with the changes proposed added in Gutenberg: https://github.com/WordPress/gutenberg/pull/33293.

The idea here is to split the growing webpack config into two parts: blocks and  packages.

We need to add handling for JavaScript files that are going to be used with blocks on the frontend. They didn't work quite well with the current setup for entry points created for packages.

As part of the effort, it adds support for `viewScript` in `block.json` metadata file that is later translated to `$view_script` in `WP_Block_Type` class and exposed as `view_script` from the REST API endpoint for block types.

Props youknowriad, desrosj, aristath.
Fixes #53690.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-28 10:06:59 +00:00
Sergey Biryukov
a207dadc10 Networks and Sites: Replace two remaining occurrences of "blog" with "site" in user-facing strings.
Follow-up to [36386], [36416], [36417], [46213].

Props audrasjb.
Fixes #53775.
Built from https://develop.svn.wordpress.org/trunk@51500


git-svn-id: http://core.svn.wordpress.org/trunk@51111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-28 10:02:00 +00:00
desrosj
28d78c0c37 Coding Standards: Apply some alignment fixes from composer format.
Follow up to [51475].

See #53729.
Built from https://develop.svn.wordpress.org/trunk@51499


git-svn-id: http://core.svn.wordpress.org/trunk@51110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-27 19:01:59 +00:00
desrosj
b055ff21bd Build/Test Tools: Remove the check for changes to version-controlled files in the Test Old Branch workflow.
This workflow does not perform a `git checkout` and is only used to dispatch workflows for old branches, so this check is not needed here.

Fixes #53799.
Built from https://develop.svn.wordpress.org/trunk@51498


git-svn-id: http://core.svn.wordpress.org/trunk@51109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-27 14:11:58 +00:00
desrosj
8f90cf9878 Upgrade/Install: Add files for 5.8 to the $_old_files list that were missed.
Follow up to [51133], [51459].

Props WFMattR, audrasjb, ocean90, johnbillion, pbiron.
Fixes #53702.
Built from https://develop.svn.wordpress.org/trunk@51497


git-svn-id: http://core.svn.wordpress.org/trunk@51108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-27 13:57:57 +00:00
Sergey Biryukov
0f9e2d2c66 Bundled Themes: Remove extra trailing spaces from translatable strings in block patterns.
Follow-up to [49583], [51045].

Props audrasjb, mukesh27.
Fixes #53774.
Built from https://develop.svn.wordpress.org/trunk@51496


git-svn-id: http://core.svn.wordpress.org/trunk@51107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-27 11:27:58 +00:00
Sergey Biryukov
1e6a658e2f Docs: Clarify the @return value for WP_Filesystem_Base::getnumchmodfromh().
Follow-up to [9117], [51494].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51495


git-svn-id: http://core.svn.wordpress.org/trunk@51106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-27 11:01:57 +00:00
Sergey Biryukov
e86e6f8771 Docs: Correct @return type for WP_Filesystem_Base::getnumchmodfromh().
Follow-up to [9117].

Props ankitmaru, johnbillion.
Fixes #53793.
Built from https://develop.svn.wordpress.org/trunk@51494


git-svn-id: http://core.svn.wordpress.org/trunk@51105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-27 09:29:01 +00:00
Sergey Biryukov
0234409d58 Tests: Rename classes in phpunit/tests/widgets/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51493


git-svn-id: http://core.svn.wordpress.org/trunk@51104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-26 19:26:56 +00:00
Sergey Biryukov
5a12666dab Tests: Rename classes in phpunit/tests/sitemaps/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51492


git-svn-id: http://core.svn.wordpress.org/trunk@51103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-26 19:10:57 +00:00
Sergey Biryukov
142e0c4bd1 Tests: Rename classes in phpunit/tests/blocks/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51491


git-svn-id: http://core.svn.wordpress.org/trunk@51102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-26 18:46:57 +00:00
Sergey Biryukov
5a4203d04a Tests: Move and fix incorrectly placed tests for block supported styles.
The `Block_Supported_Styles_Test` class is not a `TestCase` to be extended, but an actual concrete test class. In order to run as expected, it should be placed under `phpunit/tests/blocks/` along with the other block tests.

Additionally:
* Add missing visibility keywords to test methods.
* Update the expected results to the currently used format for the tests to pass.
* Remove two outdated tests. The functionality being tested there is no longer available in this manner, so these tests are redundant.

Follow-up to [49226], [49310].

Props jrf, aristath, youknowriad.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51490


git-svn-id: http://core.svn.wordpress.org/trunk@51101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-26 17:41:01 +00:00
Peter Wilson
08e06d74af Bundled Themes: Version Bump 2010, 2011 and 2012.
Version bump three bundled themes to avoid file not found and fatal errors introduced for child themes during the 5.8 release cycle.

* Twenty Ten: Version 3.5 (fatal error & 404)
* Twenty Eleven: Version 3.9 (404)
* Twenty Twelve: Version 3.5 (404)

These updates will be released mid 5.8.1 cycle due to the severity of the issues.

Follow up to [51482,51483].

Props dd32, peterwilsoncc.
Fixes #53777.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-26 03:15:00 +00:00
Sergey Biryukov
b218b7504c Media: Check the posts_per_page value in wp_ajax_query_attachments() before using it as a divisor.
This avoids a "Division by zero" PHP warning if a plugin changes the `posts_per_page` value to zero.

Follow-up to [51145].

Props 2linctools, kapilpaul, audrasjb.
Fixes #53773.
Built from https://develop.svn.wordpress.org/trunk@51485


git-svn-id: http://core.svn.wordpress.org/trunk@51096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-25 09:56:57 +00:00
Sergey Biryukov
b67f94503e Media: Remove unused code from wp-admin/includes/media.php.
Folow-up to [7043], [7062].

Props rudlinkon, hellofromTonya.
Fixes #53764.
Built from https://develop.svn.wordpress.org/trunk@51484


git-svn-id: http://core.svn.wordpress.org/trunk@51095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-24 13:03:56 +00:00
Sergey Biryukov
f053aed3ce Bundled Themes: Use correct path for loading images in block patterns.
By using `get_template_directory_uri()` instead of `get_stylesheet_directory_uri()`, we make sure to include the images from the parent theme.

This avoids displaying missing images in block patterns when using a child theme of Twenty Ten, Twenty Eleven, or Twenty Twelve.

Follow-up to [51033], [51103], [51106].

Props audrasjb.
Fixes #53769.
Built from https://develop.svn.wordpress.org/trunk@51483


git-svn-id: http://core.svn.wordpress.org/trunk@51094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-24 12:42:00 +00:00
Sergey Biryukov
5ffbad0b42 Twenty Ten: Use correct path for loading block patterns.
By using `get_template_directory()` instead of `get_stylesheet_directory()`, we make sure to include the `block-patterns.php` file from the parent theme.

This avoids a PHP fatal error when using a child theme of Twenty Ten.

Follow-up to [51106].

Props ryelle, sabernhardt, loranrendel.
Fixes #53752.
Built from https://develop.svn.wordpress.org/trunk@51482


git-svn-id: http://core.svn.wordpress.org/trunk@51093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-23 13:13:58 +00:00
Sergey Biryukov
f753d70a82 Tests: Use better assertions in WP_UnitTestCase_Base::assertEqualFields():
* Check if the object attribute exists before checking its value.
* Mention the field name in error messages in case of failure.

Follow-up to [51478], [51479], [51480].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51481


git-svn-id: http://core.svn.wordpress.org/trunk@51092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 18:50:57 +00:00
Sergey Biryukov
b38d2f9949 Tests: Modernize the WP_UnitTestCase_Base::assertEqualFields() method:
* Use `assertSame()` instead of `fail()` to display a proper message in case of failure.
* Add an optional `$message` parameter for consistency with other assertions.

Follow-up to [51478], [51479].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51480


git-svn-id: http://core.svn.wordpress.org/trunk@51091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 17:40:57 +00:00
Sergey Biryukov
79e24f3c28 Tests: Correct placement of the $message parameter in assertDiscardWhitespace().
Follow-up to [51478].

Props johnbillion.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51479


git-svn-id: http://core.svn.wordpress.org/trunk@51090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 17:26:57 +00:00
Sergey Biryukov
fa44974190 Tests: Add a $message parameter for custom assertions in WP_UnitTestCase_Base.
All assertions in PHPUnit have a `$message` parameter. Setting this parameter allows to distinguish which assertion is failing when a test runs multiple assertions, making debugging of the tests easier.

This optional parameter is now added for the assertion methods in the `WP_UnitTestCase_Base` class that were missing it.

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51478


git-svn-id: http://core.svn.wordpress.org/trunk@51089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 17:15:57 +00:00
John Blackbourn
0434d4d30b Docs: Miscellaneous docblock corrections and improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 16:54:58 +00:00
Sergey Biryukov
d19c7680e1 Tests: Correct class name for WP_Filesystem_Base::find_folder() tests.
A concrete test class should be suffixed with `Test`, not `UnitTestCase(s)`.

Follow-up to [25053].

Props jrf.
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51476


git-svn-id: http://core.svn.wordpress.org/trunk@51087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 16:45:58 +00:00
Sergey Biryukov
8a90b8691f Docs: Add a comment about the $title global usage in various admin files.
This should make it clear that the variable is used as part of the HTML `<title>` tag on admin screens.

Props ravipatel, hellofromTonya, sabernhardt, audrasjb, SergeyBiryukov.
Fixes #53729.
Built from https://develop.svn.wordpress.org/trunk@51475


git-svn-id: http://core.svn.wordpress.org/trunk@51086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 13:53:00 +00:00
Sergey Biryukov
8a975839f1 Docs: Correct a comment about WebP constants in wp-includes/compat.php.
Follow-up to [50810], [50814].

Props GaryJ, rtm909.
Fixes #53680.
Built from https://develop.svn.wordpress.org/trunk@51474


git-svn-id: http://core.svn.wordpress.org/trunk@51085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 13:07:57 +00:00
Sergey Biryukov
2871ef401b Help/About: Add / character to <img> and <source> tags.
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.

Follow-up to [47493], [48834], [50556], [51418].

Props radixweb, ankitmaru, TobiasBg, sabernhardt, audrasjb.
Fixes #53716.
Built from https://develop.svn.wordpress.org/trunk@51473


git-svn-id: http://core.svn.wordpress.org/trunk@51084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 12:58:58 +00:00
gziolo
c7ff035183 I18n: Fix broken loop in WP_Theme_JSON_Resolver
Related issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/33552

The loop in WP_Theme_JSON_Resolver to extract translatable paths was broken, as it contained an immediate and unconditional return. This caused the loop to immediately exit again after the first iteration, thus never actually looping.

Follow-up to [50959].

Props schlessera.
 

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


git-svn-id: http://core.svn.wordpress.org/trunk@51083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 10:06:57 +00:00
gziolo
60c39d7805 Editor: Conditionally load registered styles for block variations
In WordPress 5.8 we added the ability to only load styles for blocks when these blocks are rendered. However, these optimizations left out block-styles that get added using the register_block_style() function/API.

Props aristath.
Fixes #53616.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 08:38:04 +00:00
Sergey Biryukov
352fe2a88f Build/Test Tools: Update PHP_CodeSniffer to version 3.6.0.
The latest releases contain various bugfixes, as well as (nearly complete) support for PHP 8.0.

Relevant changelogs:
* https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.5.6
* https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.5.7
* https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.6.0

For a full list of changes in this update, see the PHP_CodeSniffer GitHub:
https://github.com/squizlabs/PHP_CodeSniffer/compare/3.5.5...3.6.0

Props jrf.
Fixes #53477.
Built from https://develop.svn.wordpress.org/trunk@51470


git-svn-id: http://core.svn.wordpress.org/trunk@51081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-21 14:32:03 +00:00
desrosj
32307b45b0 External Libraries: Correct the underscore version used when registering.
The correct version is `1.13.1`.

Follow up to [50650], [50778].

Props david.binda.
Fixes #53713.
Built from https://develop.svn.wordpress.org/trunk@51469


git-svn-id: http://core.svn.wordpress.org/trunk@51080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-21 12:33:59 +00:00
desrosj
bb6af43b34 External Libraries: Correct the jquery-form version used when registering.
The correct version is `4.3.0`.

Follow up to [50546].

Props david.binda.
Fixes #53714.
Built from https://develop.svn.wordpress.org/trunk@51468


git-svn-id: http://core.svn.wordpress.org/trunk@51079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-21 12:20:57 +00:00
desrosj
6574121d8a External Libraries: Correct the hoverIntent version used when registering.
Follow up to [50521].

Props david.binda.
Fixes #53715.
Built from https://develop.svn.wordpress.org/trunk@51467


git-svn-id: http://core.svn.wordpress.org/trunk@51078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-21 12:18:06 +00:00
John Blackbourn
f5713b8d71 Application Passwords: Improve various user-facing and developer-facing terminology.
Fixes #53503, #53691

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


git-svn-id: http://core.svn.wordpress.org/trunk@51074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-19 21:14:57 +00:00
Sergey Biryukov
77f6357eac Tests: Replace assertContains() with assertStringContainsString() when used with strings.
Using the `assertContains()` and `assertNotContains()` methods with string haystacks was deprecated in PHPUnit 8 and removed in PHPUnit 9.

While WordPress test suite currently only supports PHPUnit up to 7.5.x, this allows us to switch to newer assertions ahead of adding full support for PHPUnit 8+.

These methods introduced in PHPUnit 7.5 should be used as an alternative:

* `assertStringContainsString()`
* `assertStringContainsStringIgnoringCase`
* `assertStringNotContainsString()`
* `assertStringNotContainsStringIgnoringCase`

As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods were added to the `WP_UnitTestCase` class for PHPUnit < 7.5.

Follow-up to [51331], [51451], [51461].

Props jrf, dd32, SergeyBiryukov.
See #53363, #46149.
Built from https://develop.svn.wordpress.org/trunk@51462


git-svn-id: http://core.svn.wordpress.org/trunk@51073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-19 14:01:57 +00:00
Sergey Biryukov
1074ae9e4f Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertFalse( stripos( ... ) )` with `assertStringNotContainsString()` or `assertStringNotContainsStringIgnoringCase()` to use native PHPUnit functionality.

Going forward, these methods introduced in PHPUnit 7.5 should be used for similar assertions:

* `assertStringContainsString()`
* `assertStringContainsStringIgnoringCase()`
* `assertStringNotContainsString()`
* `assertStringNotContainsStringIgnoringCase()`

As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods are now added to the `WP_UnitTestCase` class for PHPUnit < 7.5.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449], [51451], [51453], [51454].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51461


git-svn-id: http://core.svn.wordpress.org/trunk@51072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-19 13:30:57 +00:00
desrosj
14f024a34a Upgrade/Install: Add additional files to $_old_files for 5.8.
Follow up to [51134].

Fixes #53367.
Built from https://develop.svn.wordpress.org/trunk@51459


git-svn-id: http://core.svn.wordpress.org/trunk@51070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-19 00:59:57 +00:00
desrosj
50db2d585f Build/Test Tools: Update the caniuse browser data and regenerate CSS.
This includes three minor updates to generated CSS files:

- A single `-webkit-` prefix is removed for `min-width`, which was required for Safari <= 10.1 (0.06% total global usage). WordPress only supports the last two versions.
- 2 instances where the `-o-` prefix are added for `tab-size`. This appears to be for Opera Mobile, which has creeped back over the 1% global usage.

Props peterwilsoncc, jorbin.
Fixes #53686.
Built from https://develop.svn.wordpress.org/trunk@51456


git-svn-id: http://core.svn.wordpress.org/trunk@51067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-19 00:41:57 +00:00
desrosj
29e534376c Bundled Themes: Bump bundled theme versions for WordPress 5.8.
This bumps the version for all bundle themes in preparation for release with WordPress 5.8. The new versions are as follows:

- Twenty Twenty-One: 1.4
- Twenty Twenty: 1.8
- Twenty Nineteen: 2.1
- Twenty Seventeen: 2.8
- Twenty Sixteen: 2.5
- Twenty Fifteen: 3.0
- Twenty Fourteen: 3.2
- Twenty Thirteen: 3.4
- Twenty Twelve: 3.4
- Twenty Eleven: 3.8
- Twenty Ten: 3.4

Props mukesh27, kapilpaul.
Fixes #53277.
Built from https://develop.svn.wordpress.org/trunk@51455


git-svn-id: http://core.svn.wordpress.org/trunk@51066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-18 23:05:00 +00:00
Sergey Biryukov
a86d4cbd85 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( ... > 0 )` with `assertGreaterThan()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449], [51451], [51453].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51454


git-svn-id: http://core.svn.wordpress.org/trunk@51065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-18 14:11:57 +00:00
Sergey Biryukov
232597b633 Tests: Use more appropriate assertions in rest_sanitize_request_arg() tests.
This replaces instances of `assertSame( true, ... )` with `assertTrue()` to use native PHPUnit functionality.

Follow-up to [38832].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51453


git-svn-id: http://core.svn.wordpress.org/trunk@51064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-18 14:01:58 +00:00
Sergey Biryukov
ff737b2d76 Tests: Require the WP_REST_Test_Controller class in WP_REST_Controller tests.
This avoids a "Class not found" PHP fatal error when running these tests separately.

Follow-up to [38832].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51452


git-svn-id: http://core.svn.wordpress.org/trunk@51063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-18 13:47:00 +00:00
Sergey Biryukov
e0c355fcaa Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( strpos( ... ) > 0 )` with `assertStringContainsString()` to use native PHPUnit functionality.

Going forward, these methods introduced in PHPUnit 7.5 should be used for similar assertions:

* `assertStringContainsString()`
* `assertStringNotContainsString()`

As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods are now added to the `WP_UnitTestCase` class for PHPUnit < 7.5.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51451


git-svn-id: http://core.svn.wordpress.org/trunk@51062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-17 10:37:58 +00:00
Sergey Biryukov
69a57fe80e Tests: Correct the test for autosaving a post with Ajax.
`wp_autosave()` only updates drafts and auto-drafts created by the current user if the post is not locked.

As a result of previous Ajax test refactoring, setting the current user and creating a test post ended up in different methods, with the user being set after the post is already created.

This resulted in the test post being created with the `post_author` field set to zero, and the current user check in `wp_autosave()` failed. Instead of updating the original post as the test intended, it created a new autosave.

The test only passed accidentally due to `assertGreaterThanOrEqual()` not performing a strict type check.

Follow-up to [26995], [35311].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51450


git-svn-id: http://core.svn.wordpress.org/trunk@51061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-17 10:24:59 +00:00
Sergey Biryukov
7bcca73ed7 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertSame( 0, strpos( ... ) )` with `assertStringStartsWith()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51449


git-svn-id: http://core.svn.wordpress.org/trunk@51060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-16 19:15:00 +00:00
Sergey Biryukov
4a8667c576 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( is_string( ... ) )` with `assertIsString()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51448


git-svn-id: http://core.svn.wordpress.org/trunk@51059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-16 09:52:00 +00:00
youknowriad
e76d4e1bcd Block Editor: Backport fixes targetted for WordPress 5.8 RC4.
This includes:

 - Suggestion List: Check if a node exists to scroll into view.
 - Autocomplete: reset state for empty text.
 - Adds auxiliary class names for editor styles in the widgets editor.
 - Extract snackbars into a separate component.
 - Rich text: run input rules after composition end.
 - iframe: load inline styles.
 - Multi select: select all: restore ref callback.
 - Writing flow: allow select all from empty selection.
 - Post Excerpt: Fix excerpt_more filter conflict and remove wordCount attribute.
 - Add the percent unit to the default units in Core.

Props desrosj.
See #53397.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-15 18:55:29 +00:00
desrosj
904862da90 Media: Document edge cases with the new image_editor_output_format filter.
More testing has revealed that the `image_editor_output_format` filter has some interesting edge cases that developers should be aware of when electing to use this filter (see #53667 and #53668).

Because this is a new filter that was intended to be used for experimenting with different ways to handle generating image sizes and has not yet been adopted in the wild, expanding the inline documentation is an acceptable temporary solution while these edge cases are explored further and addressed.

Props mikeschroder, antpb, desrosj, adamsilverstein, ianmjones.
See #5366, #53668, #35725.
Built from https://develop.svn.wordpress.org/trunk@51442


git-svn-id: http://core.svn.wordpress.org/trunk@51053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-15 17:39:59 +00:00
joedolson
f0e5f17c2c Media: Fix JS error in Media Library when infinite scroll enabled.
Wrap call to this.updateLoadMoreView() is wrapped in a check that infinite scroll is disabled to prevent JS errors.

Props wildworks.
Fixes #53672.
Built from https://develop.svn.wordpress.org/trunk@51440


git-svn-id: http://core.svn.wordpress.org/trunk@51051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-15 17:00:59 +00:00
Sergey Biryukov
1c4ec82ce7 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( is_numeric( ... ) )` with `assertIsNumeric()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51438


git-svn-id: http://core.svn.wordpress.org/trunk@51049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-15 14:45:56 +00:00
Sergey Biryukov
d3d8d166c8 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( is_a( ... ) )` with `assertInstanceOf()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51436


git-svn-id: http://core.svn.wordpress.org/trunk@51047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-15 09:08:01 +00:00
Andrew Ozz
15f9f7c6b9 Media: When resizing WebP images set the compression to "lossy" by default. Fixes a bug where the compression was set to "lossless" when the uploaded WebP images have extended file format (VP8X).
Props adamsilverstein, mikeschroder, mmxxi, linux4me2.
Fixes #53653.
Built from https://develop.svn.wordpress.org/trunk@51435


git-svn-id: http://core.svn.wordpress.org/trunk@51046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-15 00:43:00 +00:00
desrosj
88cedeac5c Bundled Themes: Revert the [51372] update to block patterns in bundled themes.
Upon further examination, this change was not great for backwards compatibility, resulting in block validation errors when running on older versions of WordPress.

While there are currently many `console.info()` notices caused by older format block syntax being updated to the current version included in WordPress 5.8, the blocks do not break.

Block patterns do not currently have a versioning mechanism, or a means to indicate which versions of WordPress are supported.

See #53617.
Built from https://develop.svn.wordpress.org/trunk@51434


git-svn-id: http://core.svn.wordpress.org/trunk@51045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-14 20:02:59 +00:00
desrosj
88309aa27e Widgets: Prevent widgets unintentionally being moved to the inactive sidebar.
This fixes a bug where widgets are unintentionally moved to the `wp_inactive_widgets` sidebar when batch updates occur through the REST API.

When batch requests are processed, only `$_wp_sidebars_widgets is updated by previous calls to `WP_REST_Widgets_Controller::create_item()`. `$sidebars_widgets` is not aware of the new widget’s intended location, and `retrieve_widgets()` mistakenly flags the widget as inactive.

Calling `wp_get_sidebars_widgets()` before `retrieve_widgets()` ensures both global variables match and is intended as a temporary fix until the root cause of the problem can be fixed.

Props zieladam, htmgarcia, timothyblynjacobs.
Fixes #53657.
Built from https://develop.svn.wordpress.org/trunk@51432


git-svn-id: http://core.svn.wordpress.org/trunk@51043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-14 16:45:58 +00:00
desrosj
440fd76242 Privacy: Ensure the copy button actually copies the suggested privacy policy text.
Follow up to [50609].

Props walbo, SergeyBiryukov.
Fixes #53652. See #52891.
Built from https://develop.svn.wordpress.org/trunk@51431


git-svn-id: http://core.svn.wordpress.org/trunk@51042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-14 16:17:59 +00:00
Sergey Biryukov
a727138559 Docs: Synchronize the $post_id argument description for some post and attachment functions.
See #53399.
Built from https://develop.svn.wordpress.org/trunk@51430


git-svn-id: http://core.svn.wordpress.org/trunk@51041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-14 08:14:01 +00:00
desrosj
b8c451cdec Editor: Second round of package updates ahead of RC3.
Props ellatrix, peterwilsoncc, get_dave, mcsf, talldanwp, youknowriad, desrosj.
Built from https://develop.svn.wordpress.org/trunk@51426


git-svn-id: http://core.svn.wordpress.org/trunk@51037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 23:58:30 +00:00
Sergey Biryukov
10f7a91fa7 Docs: Correct documentation for wp_get_post_parent_id().
The `$post` parameter is required and does not have a default value.

Follow-up to [42397].

Props denisco.
See #53399.
Built from https://develop.svn.wordpress.org/trunk@51425


git-svn-id: http://core.svn.wordpress.org/trunk@51036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 18:34:57 +00:00
desrosj
46f0cfe3ca Coding Standards: Use the correct formatting for multi-line comments.
Follow up to [51414].
Built from https://develop.svn.wordpress.org/trunk@51423


git-svn-id: http://core.svn.wordpress.org/trunk@51034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 18:02:57 +00:00
youknowriad
e270f4f0f3 Block Editor: Include the fixes targetted for WordPress 5.8 RC3.
This includes the following fixes:
 - Safari: see if compositing layer size is more reasonable when position fixed divs are not inserted into content.
 - Site Logo Block: update Site Logo block UI and option syncing.
 - Fix moving inner blocks in the Widgets Customizer.
 - Allow themes to provide empty values for color.duotone and spacing.units
 - Update getTermsInfo() to workaround parsing issue for translatable strings.
 - Specify what settings can be part of settings.layout.
 - Update conditions to hide duotone panel.
 - Prevent entering invalid values in the Query Loop block config.
 - Prevent color panel from showing as empty.
 - Avoid calling gutenberg_ functions within code shipped through WordPress Core.

Props desrosj.
See #53397.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 16:41:28 +00:00
Sergey Biryukov
8b2e5e7843 Tests: Reset $current_screen global between tests to avoid cross-test interdependencies.
This provides a consistent global starting state for tests that interact with admin screens.

Individual tests no longer need to invoke `set_current_screen( 'front' )` (or an alternative implementation) as a reset.

Follow-up to [29251], [29860], [31046], [36721], [38678], [48908], [50433].

Props hellofromTonya, johnbillion.
Fixes #53431.
Built from https://develop.svn.wordpress.org/trunk@51419


git-svn-id: http://core.svn.wordpress.org/trunk@51030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 16:14:58 +00:00
ryelle
f1e1a53f5a Help/About: Update the About page for 5.8.
Use a larger image for theme.json on retina screens, and update the spacing of sections on the page.

Props javiarce.
See #52775.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 15:39:57 +00:00
Mike Schroder
b95e0b391c Customizer: Don’t always set normalizedTransitionendEventName to null.
Reverts [51389].

Unprops mikeschroder.
See #53562.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 14:04:57 +00:00
Sergey Biryukov
8ed1859c35 Tests: Clean up skipping conditions and requirements for various tests.
This improves the consistency of test skipping and ensures that:

* The `@requires` annotations use the right condition and format, and are on the right level (class vs. function).
* Inline conditions with a `markTestSkipped()` call are only used when annotations cannot be used.
* All `markTestSkipped()` calls contain a verbose explanation of why the test is being skipped.

Props jrf, hellofromTonya.
Fixes #53009.
Built from https://develop.svn.wordpress.org/trunk@51415


git-svn-id: http://core.svn.wordpress.org/trunk@51026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 10:45:02 +00:00
Peter Wilson
34119e2c95 Widgets: Validate HTML before saving block widgets.
Props talldanwp, noisysocks, kevin940726, peterwilsoncc.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 05:59:01 +00:00
ryelle
a5cfc54fec Help/About: Update the About section for 5.8.
Update the image links to use the CDN. Use regular text color for headings. Fix two string issues. Remove unnecessary `wp-components` script & style.

Props nao, audrasjb, karmatosed, desrosj, javiarce, milana_cap.
See #52775.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 00:12:56 +00:00
desrosj
f2b3c983f6 Docs: Various documentation fixes following [51129].
- Typo corrections in filter descriptions.
- DocBlocks are now now wrapped to the next line after 80 characters, and not extending beyond 120 total characters wide.
- Remove unnecessary repeated references to the suggested replacement hooks.
- Adjustments to the indentation for consistency with other emails in Core, allowing the `phpcs:ignore` comment to be removed.

Props SergeyBiryukov.
Fixes #44314.
Built from https://develop.svn.wordpress.org/trunk@51410


git-svn-id: http://core.svn.wordpress.org/trunk@51021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 00:02:57 +00:00
desrosj
b60650f5bd Widgets: Replace wp.editor references in the legacy text widget.
This changes the references to `wp.editor` in the text widget’s JavaScript to `wp.oldEditor`, which is the new location for the old `editor` script that was previously available at `window.wp.editor`. 

Follow up to [51387-51388,51390].

Props spacedmonkey, zieladam.
Fixes #53437.
Built from https://develop.svn.wordpress.org/trunk@51409


git-svn-id: http://core.svn.wordpress.org/trunk@51020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-12 23:57:57 +00:00
desrosj
a3a7ccf107 Widgets: Use wp_sidebar_description() to retrieve a sidebar’s description.
This switches `WP_REST_Sidebars_Controller` to use `wp_sidebar_description()` for retrieving the `description` of a given sidebar instead of referencing the value in the `$wp_registered_sidebars` global variable directly.

`wp_sidebar_description()` uses `wp_kses()` to only allow the default list of `$allowed_tags` to be present in a sidebar’s `description`.

Props timothyblynjacobs, desrosj.
Fixes #53646.
Built from https://develop.svn.wordpress.org/trunk@51408


git-svn-id: http://core.svn.wordpress.org/trunk@51019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-12 19:03:57 +00:00
Sergey Biryukov
2276bef421 Coding Standards: Fix WPCS issue in [51404].
This fixes an "Expected 1 spaces before closing parenthesis; 0 found" error.

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51405


git-svn-id: http://core.svn.wordpress.org/trunk@51016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-12 10:53:59 +00:00
Sergey Biryukov
79b4f21761 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( in_array( ... ) )` with `assertContains()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403].

Props hellofromTonya, jrf, SergeyBiryukov.
Fixes #53123. See #53363.
Built from https://develop.svn.wordpress.org/trunk@51404


git-svn-id: http://core.svn.wordpress.org/trunk@51015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-12 10:37:00 +00:00
Sergey Biryukov
fb44d80643 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( empty( ... ) )` with `assertEmpty()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51403


git-svn-id: http://core.svn.wordpress.org/trunk@51014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-11 12:42:59 +00:00
Andrew Ozz
8a8c4796db TinyMCE: ensure initialization runs in all cases on 'interactive' and 'complete' readyState. Fixes a rare bug when the init code is inserted in the DOM after the page has finished loading.
Props Collizo4sky, azaozz.
Fixes #53632.
Built from https://develop.svn.wordpress.org/trunk@51402


git-svn-id: http://core.svn.wordpress.org/trunk@51013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-10 23:58:57 +00:00
Sergey Biryukov
f45d515ff8 Twenty Fifteen: Use strict comparison in inc/custom-header.php.
Props kapilpaul.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51401


git-svn-id: http://core.svn.wordpress.org/trunk@51012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-10 18:43:57 +00:00
Sergey Biryukov
84f725010b Bundled Themes: Correct comment formatting in inc/block-patterns.php.
Follow-up to [51045], [51103].

Props kapilpaul.
See #53359, #52627.
Built from https://develop.svn.wordpress.org/trunk@51400


git-svn-id: http://core.svn.wordpress.org/trunk@51011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-10 18:40:57 +00:00
Sergey Biryukov
c205a7e583 Coding Standards: Rename the $ID variable to $user_id in wp_insert_user() and wp_update_user().
This fixes a "Variable `$ID` is not in valid snake_case format" WPCS warning.

Follow-up to [2872].

See #53359.
Built from https://develop.svn.wordpress.org/trunk@51399


git-svn-id: http://core.svn.wordpress.org/trunk@51010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-10 12:21:58 +00:00
Sergey Biryukov
514f23aef8 Users: Return earlier from wp_update_user() in case of error.
This ensures that if the `wp_insert_user()` call resulted in a `WP_Error` object, it is returned right away without any further actions.

Follow-up to [32820].

Fixes #53627.
Built from https://develop.svn.wordpress.org/trunk@51398


git-svn-id: http://core.svn.wordpress.org/trunk@51009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-10 12:00:58 +00:00
Sergey Biryukov
d4ca0e0790 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( isset( ... ) )` with `assertArrayHasKey()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51397


git-svn-id: http://core.svn.wordpress.org/trunk@51008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-10 11:16:58 +00:00
Sergey Biryukov
c51c4ab729 Code Modernization: Only check collation in wpdb methods if the query is not empty.
This avoids a deprecation notice on PHP 8.1 caused by passing `null` instead of a string to `ltrim()` in `wpdb::check_safe_collation()`, and maintains the current behaviour.

Follow-up to [30345], [32162], [33455].

See #53635.
Built from https://develop.svn.wordpress.org/trunk@51396


git-svn-id: http://core.svn.wordpress.org/trunk@51007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-10 11:15:59 +00:00
Sergey Biryukov
e304c93a58 Coding Standards: Add missing semicolon to endforeach keywords in media templates.
Follow-up to [27411], [27440].

Props vishitshah, mukesh27, nielslange, sabernhardt.
Fixes #46103.
Built from https://develop.svn.wordpress.org/trunk@51395


git-svn-id: http://core.svn.wordpress.org/trunk@51006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-10 10:40:58 +00:00
Sergey Biryukov
7922a90974 I18N: Translate _doing_it_wrong() messages in wp_check_widget_editor_deps().
This makes them consistent with other similar messages in core.

Follow-up to [51387], [51388], [51390].

See #53437, #53569.
Built from https://develop.svn.wordpress.org/trunk@51391


git-svn-id: http://core.svn.wordpress.org/trunk@51002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-09 10:57:59 +00:00
Sergey Biryukov
eb9d31bb11 Docs: Some documentation improvements for wp_check_widget_editor_deps():
* Add missing short description for the function.
* Correct function names in `_doing_it_wrong()` calls.
* Document the usage of `$wp_scripts` and `$wp_styles` globals.
* Update syntax for multi-line comment per the documentation standards.

Follow-up to [51387], [51388].

See #53437, #53569.
Built from https://develop.svn.wordpress.org/trunk@51390


git-svn-id: http://core.svn.wordpress.org/trunk@51001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-09 10:50:56 +00:00
Mike Schroder
8222719bc9 Customizer: Skip animations when they have no duration.
In addition to skipping animations when a related style doesn't Exist, now checks to see if animation styles are Empty as well.

This resolves a case where the Gutenberg End to End tests were failing, due to running with animations disabled.

This change should also help some users who are intentionally overriding styles to remove animations.

See https://github.com/WordPress/gutenberg/issues/32024 for the original Gutenberg issue.

Props zieladam, isabel_brison, kevin940726, desrosj, mikeschroder.
Fixes #53562.
See #53542.
Built from https://develop.svn.wordpress.org/trunk@51389


git-svn-id: http://core.svn.wordpress.org/trunk@51000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-09 08:13:58 +00:00
noisysocks
846529de97 Widgets: Warn when wp-editor script or wp-edit-post style is enqueued in widgets editor
It is common that plugins erroneously have `wp-editor` or `wp-edit-post` as a
dependency in a script that is loaded in the new widgets editor. This is a smell
since both `@wordpress/editor` and `@wordpress/edit-post` assume the existence
of a global "post" object which the widgets editor does not have.

[51387] fixes the user-facing errors typically caused by this mistake, but we
can go a step further and warn developers about this by calling
`_doing_it_wrong()` when we detect that the `wp-editor` script or `wp-edit-post`
style is enqueued alongside `wp-edit-widgets` or `wp-customize-widgets`.

See #53437.
Fixes #53569.
Props zieladam, spacedmonkey, TimothyBlynJacobs, andraganescu, dlh.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-09 01:18:57 +00:00
noisysocks
c57e6f00fe Editor: Merge conflicting wp.editor objects into single, non-conflicting object
The `wp-editor` script (`@wordpress/editor` npm package) is exposed as
`window.wp.editor` in WP Admin.  This causes problems, though, as many older
scripts expect to see the older `editor` script available at `window.wp.editor`.

The solution is to export all the members of the older `window.wp.editor` module
in the newer module to maintain backwards compatibility.

See #53437.
Props zieladam, spacedmonkey, TimothyBlynJacobs, andraganescu.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-09 01:10:57 +00:00
jorgefilipecosta
d05e5232b7 Block Editor: Fix for theme.json: color.duotone and spacing.units should allow empty sets.
This commit fixes an issue with the color.duotone & spacing.units in which empty values didn't override previous origins, resulting in that a theme couldn't provide an empty set for this via its theme.json.

Props nosolosw, youknowriad, aristath.
See #53175.
Built from https://develop.svn.wordpress.org/trunk@51383


git-svn-id: http://core.svn.wordpress.org/trunk@50994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-08 19:31:57 +00:00
Sergey Biryukov
2d18007ac5 Coding Standards: Remove wrapping HTML tags from translatable strings.
This fixes a "Strings should not be wrapped in HTML" WPCS warning in help tabs for Export Personal Data and Erase Personal Data screens.

Follow-up to [50147].

See #53359.
Built from https://develop.svn.wordpress.org/trunk@51381


git-svn-id: http://core.svn.wordpress.org/trunk@50992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-08 17:07:58 +00:00
Dominik Schilling
2f170f54ea Script Loader: Update jQuery version to 3.6.0 following the update in [50520].
Props audrasjb.
See #52707.
Built from https://develop.svn.wordpress.org/trunk@51380


git-svn-id: http://core.svn.wordpress.org/trunk@50991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-08 07:19:57 +00:00
Aaron Jorbin
381a720ea9 Fix merge info.
[51378] contained merge info it shouldn't and accidentally a line of code from one of those commits that another one had changed.

See #53604.
Unprops jorbin.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 22:47:56 +00:00
Aaron Jorbin
f4acd73b70 Posts: Fix Spelling in inline docs.
A warpper is the traditional home of a neditor. They generally are optimized for supporting the good quality content that a neditor requires to survive. Some warppers feel like they have been around forever but have laid a foundation for newer warppers. A specific Russian warppers is known for having a wide footprint and touching almost everything. Warppers were originally only found subversioned underground, but they have been able to GIT above ground in the last few years.

The number of warpers in the world is small, but without them the neditor would never survive.

See [23105], [51375], #53604.
Props SergeyBiryukov.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 22:39:57 +00:00
TimothyBlynJacobs
3f7c228c90 REST API: Ensure a sidebar's widgets property is a list.
When a widget is removed from a sidebar, if it was removed from the middle of the list, the widgets property would become an object with numeric keys.

The sidebars controller now forces the widgets property to be a list.

Props walbo.
Fixes #53612.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 19:35:57 +00:00
desrosj
501e37bf2b Posts: Allow the list of wrapper blocks to be filtered.
This introduces the `excerpt_allowed_wrapper_blocks` filter for controlling which blocks should be considered wrapper blocks.

Wrapper blocks and their nested contents are not stripped by `excerpt_remove_blocks()`, allowing their contents to appear in generated excerpts.

Follow up to [51348].

Props aristath, jorbin.
See #53604.
Built from https://develop.svn.wordpress.org/trunk@51375


git-svn-id: http://core.svn.wordpress.org/trunk@50986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 19:10:57 +00:00
desrosj
b16abdec23 Bundled Themes: Update block patterns to match the latest versions of core/* blocks.
When using the post editor with a bundled theme active, there will be a number of `console.info` notices printed to the browser’s console.

These notices are caused by block patterns containing outdated and deprecated versions of `core/*` blocks. Before rendering the blocks, they need to be updated, and this process outputs information to the console.

Props ntsekouras.
Fixes #53617.
Built from https://develop.svn.wordpress.org/trunk@51372


git-svn-id: http://core.svn.wordpress.org/trunk@50983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 17:31:00 +00:00
desrosj
cf711280e0 Tests: Add missed file update in [51370].
See #53497.
Built from https://develop.svn.wordpress.org/trunk@51371


git-svn-id: http://core.svn.wordpress.org/trunk@50982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 15:55:58 +00:00
desrosj
13695f4abd Themes: Remove mention of “FSE” in Core.
“FSE” themes are block themes.

Fixes #53497.
Built from https://develop.svn.wordpress.org/trunk@51370


git-svn-id: http://core.svn.wordpress.org/trunk@50981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 15:49:57 +00:00
desrosj
0a4c5d0f01 Tests: Expand tests for get_block_editor_settings().
This adds unit tests to ensure `get_block_editor_settings()` properly maps some previously experimental features to their correct locations in the array of contextualized block editor settings returned by the function.

Follow up to [51149], [51213].

Props felipeelia.
Fixes #53458.
Built from https://develop.svn.wordpress.org/trunk@51369


git-svn-id: http://core.svn.wordpress.org/trunk@50980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 14:13:57 +00:00
Sergey Biryukov
a1418c50bd Coding Standards: Fix WPCS issues in [51367].
This fixes an "Expected 1 space after comma in argument list; 2 found" error.

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51368


git-svn-id: http://core.svn.wordpress.org/trunk@50979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 10:51:58 +00:00
Sergey Biryukov
4c165a015e Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertSame( [number], count( ... ) )` with `assertCount()` to use native PHPUnit functionality.

Follow-up to [51335], [51337].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51367


git-svn-id: http://core.svn.wordpress.org/trunk@50978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 10:34:00 +00:00
Peter Wilson
d73dcb8378 Block Editor: Update packages with latest fixes for 5.8 RC2
Includes the following fixes:

- Query Block: Type validation of `WP_Query` parameters.

Props ntsekouras, stevehenty, peterwilsoncc, desrosj.
Fixes #53397.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 23:57:21 +00:00
ryelle
39ff1d6709 Help/About: Update placeholder links on About page.
Props SergeyBiryukov, audrasjb.
See #52775.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 22:04:58 +00:00
iandunn
8b025acd61 Multisite: Log error/warnings/notices from ms-files.php.
Previously errors were not displayed or logged, but the original intention was only to prevent them from being displayed. Hiding them from logs makes problems like #53492 much harder to debug.

This makes the handling of errors in `ms-files` consistent with the REST API, `admin-ajax`, and XML-RPC.

Props iandunn, johnjamesjacoby.
Fixes #53493.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 20:21:57 +00:00
ryelle
72f034f636 Help/About: Update the About section for 5.8.
Add the images for About, Freedoms, and Privacy. Update the styles on all About section pages to match the About page style. Fix string issues, missing link wrapper, duplicate copy.

Props chanthaboune, kellychoffman, javiarce, ryokuhi, alanjacobmathew, desrosj.
See #52775.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 18:38:57 +00:00
John Blackbourn
1940e5d03e Build/Test Tools: Add assertions to ensure version-controlled files are not modified during CI, and fix the grunt clean command.
Some tests and some commands that run during the build steps modify files that are under version control. This adds assertions to ensure that these files don't remain in a modified state after the test runs on CI.

This also fixes the `grunt clean` command which erroneously deletes `script-loader-packages.php`. This file is re-populated during the build, but deleting it during the clean is undesirable.

Fixes #53606

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


git-svn-id: http://core.svn.wordpress.org/trunk@50964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 18:37:57 +00:00
John Blackbourn
5f67ba0406 Docs: Correct the @since tag for the user_erasure_fulfillment_email_headers filter.
See #44314, #53461

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


git-svn-id: http://core.svn.wordpress.org/trunk@50962 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 18:18:02 +00:00
desrosj
5ce4f59f07 Themes: Remove inline comment that is not relevant in WordPress Core.
This removes an inline comment block that was added when importing the `WP_Theme_JSON` class in [50959]. The comment is relevant to the code only when viewed within the context of the Gutenberg plugin.

Props nosolosw, jorbin.
Fixes #53576.
Built from https://develop.svn.wordpress.org/trunk@51352


git-svn-id: http://core.svn.wordpress.org/trunk@50961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 18:14:57 +00:00
desrosj
faa69b408c Tests: Update the wp-api-generated.js fixture.
Follow up to [51241].

Props johnbillion.
See #53606.
Built from https://develop.svn.wordpress.org/trunk@51351


git-svn-id: http://core.svn.wordpress.org/trunk@50960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 15:59:59 +00:00
desrosj
1dcad8f5bb REST API: Add the $request parameter to methods checking permissions.
This adds the `$request` parameter to the `permissions_check()` methods within `WP_REST_Widgets_Controller` and adds `$request` as an allowed parameter to the `permissions_check()` method within `WP_REST_Templates_Controller`.

Even when this parameter is not used by default, it should be implemented to support the class being extended and the method overidden.

Props johnbillion, timothyblynjacobs.
Fixes #53593.
Built from https://develop.svn.wordpress.org/trunk@51349


git-svn-id: http://core.svn.wordpress.org/trunk@50958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 15:43:00 +00:00
desrosj
98579e4495 Posts: Prevent an empty excerpt when groups and nested column blocks are present.
This improves the logic within `excerpt_remove_blocks()` to better handle `innerBlocks`. This prevents an empty excerpt from being returned when `core/columns`, `core/column`, and `core/group` blocks are present.

This issue has been surfaced in the Query Loop block, where excerpts can be set to display. 

Props aristath.
Fixes #53604.
Built from https://develop.svn.wordpress.org/trunk@51348


git-svn-id: http://core.svn.wordpress.org/trunk@50957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 15:32:57 +00:00
youknowriad
5ab81a5f38 Block Editor: Update packages with latest fixes for 5.8 RC2
Includes the following fixes:

 - [Block Library]: Less warnings when blocks try to render themselves.
 - Reset z-index on focused widget form
 - Refactor appender margin.
 - Fix slash inserter for widgets screen.
 - Widget screens: set html block as freeform content handler.
 - Widget Block: widget_id is undefined when a widget is placed.
 - Add <CopyHandler> to WidgetAreasBlockEditorProvider
 - Add width: 100% to components-base-control inside wp-block-legacy-widget
 - [Widgets editor] Replace the "technical" error notice a more user-friendly one
 - Fix legacy widget height overflow 
 - Fix "Select all" behavior in the editor 
 - Increase specificity of the NoPreview CSS rules to avoid conflicts with theme styles
 - Fix move to widget area checkmark
 - Replace legacy widget icon with its new version
 - [Block Library - Query Loop]: Set default block variations not to inherit from global query

See #53397.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 14:38:40 +00:00
desrosj
833382b2c9 Bundled Themes: Correct customzier typo.
This was found in Twenty Twenty-One and Twenty Nineteen.

Props audrasjb, spytzo, sabernhardt.
Fixes #53598.
Built from https://develop.svn.wordpress.org/trunk@51343


git-svn-id: http://core.svn.wordpress.org/trunk@50952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 14:02:57 +00:00
desrosj
038904da7c I18N: Correct recurring lenghts typo.
Props mikaelmayer.
Fixes #53600.
Built from https://develop.svn.wordpress.org/trunk@51342


git-svn-id: http://core.svn.wordpress.org/trunk@50951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 13:52:57 +00:00
desrosj
6f2b454864 Build/Test Tools: Use caching built into actions/setup-node.
This updates the `actions/setup-node` action to version 2.2.2 and takes advantage of the cache feature now built in. This removes the need for an additional step using `actions/cache` to cache NPM dependencies.

The cache key used will be `${{ runner.os }}-npm-${{ hashFiles('') }}`, which matches the recommendation in the `actions/cache` documentation and the key currently in use in the WordPress workflows.

Props gziolo.
Fixes #53584.
Built from https://develop.svn.wordpress.org/trunk@51341


git-svn-id: http://core.svn.wordpress.org/trunk@50950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 13:13:59 +00:00
Sergey Biryukov
0d2ce875d7 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( is_object( ... ) )` with `assertIsObject()` to use native PHPUnit functionality.

Follow-up to [51331], [51335].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51337


git-svn-id: http://core.svn.wordpress.org/trunk@50946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 12:32:57 +00:00
Sergey Biryukov
5bef1b8001 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( is_array( ... ) )` with `assertIsArray()` to use native PHPUnit functionality.

Follow-up to [51331].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51335


git-svn-id: http://core.svn.wordpress.org/trunk@50944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 12:26:56 +00:00
Sergey Biryukov
7a836ad413 Tests: Move loading compatibility layers for PHPUnit 6+ and 7.5+ closer together.
Follow-up to [40536], [44701], [50986].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51333


git-svn-id: http://core.svn.wordpress.org/trunk@50942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 11:35:00 +00:00
Aaron Jorbin
228f2d9d39 Update the IRC link from Freenode to Libera.chat.
Update follows the update to https://make.wordpress.org/support/handbook/appendix/other-support-locations/introduction-to-irc/.

Fixes #53590.
Props empatogen, audrasjb.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-05 19:31:59 +00:00
Sergey Biryukov
94c6df96bc Build/Test Tools: Replace assertInternalType() usage in unit tests.
The `assertInternalType()` and `assertNotInternalType()` methods are deprecated in PHPUnit 8 and removed in PHPUnit 9.

While WordPress test suite currently only supports PHPUnit up to 7.5.x, this allows us to switch to newer assertions ahead of adding full support for PHPUnit 8+.

These methods introduced in PHPUnit 7.5 should be used as an alternative:

* `assertIsArray()`
* `assertIsBool()`
* `assertIsFloat()`
* `assertIsInt()`
* `assertIsNumeric()`
* `assertIsObject()`
* `assertIsResource()`
* `assertIsString()`
* `assertIsScalar()`
* `assertIsCallable()`
* `assertIsIterable()`
* `assertIsNotArray()`
* `assertIsNotBool()`
* `assertIsNotFloat()`
* `assertIsNotInt()`
* `assertIsNotNumeric()`
* `assertIsNotObject()`
* `assertIsNotResource()`
* `assertIsNotString()`
* `assertIsNotScalar()`
* `assertIsNotCallable()`
* `assertIsNotIterable()`

As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods are now added to the `WP_UnitTestCase` class for PHPUnit < 7.5.

Props pbearne, jrf, dd32, SergeyBiryukov.
Fixes #53491. See #46149.
Built from https://develop.svn.wordpress.org/trunk@51331


git-svn-id: http://core.svn.wordpress.org/trunk@50940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-05 17:22:57 +00:00
John Blackbourn
2e6a782a5f Docs: Miscellaneous docblock improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-05 15:48:00 +00:00
Sergey Biryukov
0dadbcab6b Docs: Correct description for the upgrader_pre_install filter.
Props ilovecats7.
Fixes #53546.
Built from https://develop.svn.wordpress.org/trunk@51329


git-svn-id: http://core.svn.wordpress.org/trunk@50938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-04 10:06:57 +00:00
Sergey Biryukov
ca92ebece3 Docs: Add @since tags for WP_Theme class properties.
Document WordPress versions Twenty Twelve and later bundled themes were introduced in.

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51328


git-svn-id: http://core.svn.wordpress.org/trunk@50937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-04 09:58:58 +00:00
John Blackbourn
efaf4a8938 Docs: Add and correct examples of common names for various dynamic hooks.
See #53581

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


git-svn-id: http://core.svn.wordpress.org/trunk@50936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-03 21:42:59 +00:00
John Blackbourn
6b78871b4a Docs: Document common names for dynamic hooks relating to metadata.
See #53581

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


git-svn-id: http://core.svn.wordpress.org/trunk@50935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-03 21:32:58 +00:00
Sergey Biryukov
39cb388519 Docs: Correct @see references for hooks in the get_option() description.
Follow-up to [51050].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51324


git-svn-id: http://core.svn.wordpress.org/trunk@50933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-03 11:31:58 +00:00
Sergey Biryukov
9c0611e9c0 Bundled Themes: Correct @since tags for block patterns.
Follow-up to [49347], [49348], [49583], [49584], [49763], [51103].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51323


git-svn-id: http://core.svn.wordpress.org/trunk@50932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-03 09:41:58 +00:00
Sergey Biryukov
af7a04318d Twenty Twenty: Add missing documentation for some filters.
Add missing `@since` tags for some functions.

Correct alignment of some `@param` tags.

Follow-up to [46271], [46278], [51304].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51322


git-svn-id: http://core.svn.wordpress.org/trunk@50931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-03 09:14:58 +00:00
Aaron Jorbin
bf92ee343c Remove unnecessary function_exists check in get_the_block_template_html
WordPress can be confident that WordPress functions exist.

I forgot this function existed.
And I thought that it would fatal, but it didn't
And it was so nice
So peaceful and quiet
I forgot this function existed
It isn't love, it isn't hate, it's just indifference

Introduced in [51003].

Props walbo.
Fixes #53578. See #53176.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 21:52:57 +00:00
desrosj
3e271ba7a7 Editor: Ensure global styles are loaded in the footer when loading core assets individually.
This fixes the logic in `wp_enqueue_global_styles()` to ensure that global styles are loaded in the footer when a site opts-in to loading Core block assets individually.

This fixes a bug where styles defined in `themes.json` are not respected.

Props walbo, nosolosw, mcsf, aristath, desrosj.
Fixes #53494.
Built from https://develop.svn.wordpress.org/trunk@51309


git-svn-id: http://core.svn.wordpress.org/trunk@50918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 18:47:58 +00:00
desrosj
bc5908011b Editor: Ensure the Query block pattern category is translatable.
Because the `__()` translation function was used here, the Query block pattern category string is not translatable. `_x()` is the correct function here as that passes the second parameter as context and not text domain.

Follow up to [50948].

Props walbo.
Fixes #53577.
Built from https://develop.svn.wordpress.org/trunk@51307


git-svn-id: http://core.svn.wordpress.org/trunk@50916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 14:35:58 +00:00
desrosj
433448f1d8 Editor: Remove the experimental experimental-link-color feature.
This has been plugin only so far and should remain so.

Follow up to [50959].

Props nosolosw.
Fixes #53175.
Built from https://develop.svn.wordpress.org/trunk@51306


git-svn-id: http://core.svn.wordpress.org/trunk@50915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 13:02:58 +00:00
Sergey Biryukov
d0c596c992 Twenty Twenty-One: Add missing documentation for some filters.
Add missing `@since` tags for some functions.

Follow-up to [49216], [49220], [49854], [51294].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51304


git-svn-id: http://core.svn.wordpress.org/trunk@50913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 08:57:57 +00:00
Sergey Biryukov
7ec8606aeb Docs: Correct description for the $image parameter of the wp_save_image_file filter.
Follow-up to [27357], [48798], [51302].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51303


git-svn-id: http://core.svn.wordpress.org/trunk@50912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 07:11:58 +00:00
John Blackbourn
ec4eb88e0f Docs: Further type corrections and improvements for various docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 22:02:57 +00:00
John Blackbourn
e4cfebe92e Docs: Undo the accidental revert of [51299] made in [51300].
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:29:56 +00:00
John Blackbourn
ea60cd8191 Docs: Descriptive improvements and corrections for various docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:12:58 +00:00
John Blackbourn
9146628ae1 Docs: Miscellaneous formatting corrections for docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:10:56 +00:00
John Blackbourn
79685db062 Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +00:00
John Blackbourn
00a0c0f3d5 Docs: Fix the documentation for the $tests parameter of the site_status_tests filter.
Tests are contained within `direct` and `async` properties of this array, not directly in the array itself. This also clarifies the properties that differ between direct and async tests.

See #53399, #46573

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


git-svn-id: http://core.svn.wordpress.org/trunk@50906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 20:37:57 +00:00
desrosj
a54727d936 Twenty Twenty-One: Ensure the dropdown arrow displays for <select> elements when focused.
Props isabel_brison, zieladam, poena.
Fixes #53560.
Built from https://develop.svn.wordpress.org/trunk@51296


git-svn-id: http://core.svn.wordpress.org/trunk@50905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 19:55:58 +00:00
Sergey Biryukov
61b5311c57 Twenty Twenty-One: Improve documentation per the documentation standards:
* Remove unnecessary `@access` tags that were previously removed from core.
* Remove an empty line between `@param` and `@return` tags.
* Correct alignment of `@param` tags.

Follow-up to [41161], [41162], [41168], [49216], [49220].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51294


git-svn-id: http://core.svn.wordpress.org/trunk@50903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 12:59:57 +00:00
Sergey Biryukov
4871e33916 Docs: Correct documentation for rest_{$post_type}_query and rest_{$taxonomy}_query filters.
Synchronize documentation for related `rest_{$object_type}_query` filters for consistency.

Props dlh.
Fixes #53568.
Built from https://develop.svn.wordpress.org/trunk@51293


git-svn-id: http://core.svn.wordpress.org/trunk@50902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 09:12:59 +00:00
Sergey Biryukov
d999568ae4 Docs: Improve documentation for optional parameters in WP_Theme_JSON methods per the documentation standards.
Additionally:
* Remove an empty line between `@param` and `@return` tags.
* Correct alignment of `@param` tags.

Follow-up to [50959], [50973], [51149], [51284], [51289].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51292


git-svn-id: http://core.svn.wordpress.org/trunk@50901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 19:00:58 +00:00
Sergey Biryukov
1b749d971a Docs: Remove an empty line between @param and @return tags in some newly added REST API methods, per the documentation standards.
Follow-up to [48242], [49925], [51003], [51021].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51289


git-svn-id: http://core.svn.wordpress.org/trunk@50898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 18:43:58 +00:00
desrosj
9e3049477c Script Loader: Revert [51267].
This was missed in [51268] when reverting [51259-51260,51265].

Props pbiron.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51288


git-svn-id: http://core.svn.wordpress.org/trunk@50897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 18:26:03 +00:00
Sergey Biryukov
df662d1e24 Coding Standards: Add missing visibility keywords to WP_Theme, WP_Theme_JSON, and WP_Theme_JSON_Resolver tests.
Follow-up to [50959], [50960], [50967].

See #52627.
Built from https://develop.svn.wordpress.org/trunk@51287


git-svn-id: http://core.svn.wordpress.org/trunk@50896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 18:22:57 +00:00
Sergey Biryukov
8f4593b124 Docs: List the expected type first instead of WP_Error in some REST API methods added in 5.8.
Follow-up to [46696], [49929], [50995], [51021].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51286


git-svn-id: http://core.svn.wordpress.org/trunk@50895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 17:59:58 +00:00
Sergey Biryukov
e7b6a4dce8 Coding Standards: Remove redundant type casting to array in WP_Query::get_posts().
This brings some consistency with other instances of using `get_post_stati()` in core.

`get_post_stati()` always returns an array, so the type casting is not needed.

Follow-up to [13172].

See #53359.
Built from https://develop.svn.wordpress.org/trunk@51285


git-svn-id: http://core.svn.wordpress.org/trunk@50894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 17:44:58 +00:00
Sergey Biryukov
a58c86abd8 Docs: Improve documentation for optional parameters in WP_Theme_JSON_Resolver methods per the documentation standards.
Move `add_action()` call to `wp-includes/default-filters.php`.

Follow-up to [50959], [51221].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51284


git-svn-id: http://core.svn.wordpress.org/trunk@50893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 17:20:58 +00:00
Sergey Biryukov
40ff2751bc Docs: Add missing @since tags for some WP_Theme_JSON methods.
Docs: Update syntax for multi-line comments per the documentation standards.

Follow-up to [50959], [50967], [50973], [51051], [51089], [51149].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51283


git-svn-id: http://core.svn.wordpress.org/trunk@50892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 16:23:57 +00:00
Sergey Biryukov
b10b4a2586 Docs: Adjust wp_dashboard_browser_nag() DocBlock per the documentation standards.
Follow-up to [51117], [51119], [51120].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51282


git-svn-id: http://core.svn.wordpress.org/trunk@50891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 16:07:57 +00:00
Sergey Biryukov
7884c33821 Docs: Add @ticket references to some WP_Theme_JSON tests.
Follow-up to [50973], [51054].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51281


git-svn-id: http://core.svn.wordpress.org/trunk@50890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 15:59:58 +00:00
Sergey Biryukov
598c337f4b Docs: Add missing @since tags for some REST API methods added in 5.8.
Follow-up to [50995], [51021].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51280


git-svn-id: http://core.svn.wordpress.org/trunk@50889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 13:58:59 +00:00
Sergey Biryukov
a2f00a677c Docs: Document the globals used in WP_REST_Widget_Types_Controller and WP_REST_Widgets_Controller.
Follow-up to [50995].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51279


git-svn-id: http://core.svn.wordpress.org/trunk@50888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 12:55:57 +00:00
Sergey Biryukov
d72eb14abf Docs: Document the globals used in some REST API methods.
See #53399.
Built from https://develop.svn.wordpress.org/trunk@51278


git-svn-id: http://core.svn.wordpress.org/trunk@50887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 12:34:56 +00:00
Sergey Biryukov
ffafbefc36 REST API: Allow multiple widgets to be deleted in a single batch request.
This resets the `WP_Widget::$updated` flag when deleting a widget, to avoid blocking all future updates in a request.

Props noisysocks, andraganescu.
Fixes #53557.
Built from https://develop.svn.wordpress.org/trunk@51277


git-svn-id: http://core.svn.wordpress.org/trunk@50886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 10:41:58 +00:00
Peter Wilson
4c598d36b1 Query: Check each post-type's capabilities when querying multiple post-types.
When querying multiple post types, check the `read_private_posts` capability for each post type when determining which post statuses to return. This ensures private posts appear in search results and archives for users permitted to read them.

Props leogermani, hellofromTonya, jeffpaul, peterwilsoncc.
Fixes #48556.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 05:00:56 +00:00
desrosj
7344160c11 Security: Add 5.8 to the list of versions receiving security updates.
Built from https://develop.svn.wordpress.org/trunk@51274


git-svn-id: http://core.svn.wordpress.org/trunk@50883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 04:02:57 +00:00
desrosj
a610e9675b Build/Test Tools: Add the 5.8 branch to the workflow for testing branches.
Built from https://develop.svn.wordpress.org/trunk@51273


git-svn-id: http://core.svn.wordpress.org/trunk@50882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 03:58:58 +00:00
desrosj
4f26a88360 Post branching 5.8 version bump.
`trunk` is now `5.9-alpha`.
Built from https://develop.svn.wordpress.org/trunk@51272


git-svn-id: http://core.svn.wordpress.org/trunk@50881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 03:55:56 +00:00
desrosj
2c1f2bf1e4 Post WordPress 5.8 RC1 version bump.
Built from https://develop.svn.wordpress.org/trunk@51270


git-svn-id: http://core.svn.wordpress.org/trunk@50879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 03:44:58 +00:00
desrosj
77d0f6114f WordPress 5.8 RC1.
Built from https://develop.svn.wordpress.org/trunk@51269


git-svn-id: http://core.svn.wordpress.org/trunk@50878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 03:16:56 +00:00
desrosj
8c3e1e9aa8 Build/Test Tools: Revert [51259-51256,51265].
[51259] introduced a PHP notice that was not actually fixed by [51265]. Reverting these changes in order to investigate further.

See #53397.
Built from https://develop.svn.wordpress.org/trunk@51268


git-svn-id: http://core.svn.wordpress.org/trunk@50877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 02:14:56 +00:00
desrosj
e7387a9ace Script Loader: Fix PHP notice caused by the viewScript for the core/file block.
This fixes a PHP notice caused by the `viewScript` for the `core/file` block having `.min.js` instead of just `.js`.

`register_block_script_handle()` was incorrectly looking for `view.min.asset.php`, which does not exist, and caused the `_doing_it_wrong()` notice.

This adds a check for `.min.js` in the `viewScript` field of `block.json` and corrects it to `.js` in order to match the expected pattern of `view.asset.php` until a more permanent fix can be created.

Follow up to [51259].

Props ipstenu, pbiron, peterwilsoncc.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51267


git-svn-id: http://core.svn.wordpress.org/trunk@50876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 01:46:57 +00:00
Peter Wilson
1b7cd950ca Upgrade/Install: Notify users of deactivated plugins during upgrade.
This adds a one-off notice to the dashboard in the event WordPress has automatically deactivated a plugin due to incompatibility with the new version of WordPress.

Introduces the new private function `deactivated_plugins_notice()` to display the notice in the dashboard. Introduces the new auto-loaded option `wp_force_deactivated_plugins` to store a list of automatically deactivated plugins; the option is used on both a site and network level.

Follow up to [51180].

Props desrosj, jorbin, azaozz, SergeyBiryukov, peterwilsoncc.
See #53432.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 00:21:58 +00:00
desrosj
8fa45ab8f8 Script Loader: Add file block assets to the svn-ignore list.
These are automatically generated and should not be committed.

Follow up to [51259].

Props gziolo, youknowriad.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51265


git-svn-id: http://core.svn.wordpress.org/trunk@50874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 19:10:57 +00:00
ryelle
aea10c0c44 Help/About: WordPress 5.8 About Page.
This is the start of the WordPress 5.8 about page, introducing new content and a first pass of the new style.

Props chanthaboune, cbringmann, webcommsat, marybaum, melchoyce, shaunandrews, desrosj, ryelle, oglekler, yvettesonneveld, nalininonstopnewsuk, meher, femkreations, alanjacobmathew, courane01, annezazu, matveb, milana_cap, javiarce, ryokuhi, audrasjb.
See #52775.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 19:06:57 +00:00
Aaron Jorbin
ad14ee34eb Docs: Further Improve documentation for wp_should_load_separate_core_block_assets().
In [51256], the documentation was improved, this further improves it. As scripts are not yet a part of what this function does, they are not mentioned explicitly. Assets is used so that the docs don't need a lot of improvements when scripts do come into play..

Props desrosj, SergeyBiryukov, Jorbin.
See #53505.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 18:45:56 +00:00
desrosj
6fc65b33d5 Script Loader: Use the provided block version when registering styles.
This updates `register_block_style_handle()` to use the `version` value provided in the `$metadata` parameter for non-Core blocks (when present). This removes the requirement to use `filemtime()` to generate a unique version.

When `version` is not defined within `$metadata`, the script version will fallback to using the current version of WordPress.

The block version should be considered similar to the one specified by plugin developers within the header of the main plugin file.

Props hellofromTonya, gziolo, jorbin, desrosj, walbo, aristath.
Fixes #53507.
Built from https://develop.svn.wordpress.org/trunk@51262


git-svn-id: http://core.svn.wordpress.org/trunk@50871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 18:24:56 +00:00
youknowriad
2f27f24191 Block Editor: Include the latest fixes targetted for 5.8 RC1.
It includes:

 - Add a label for screen reader in categories block gutenberg#33060
 - Remove "is-dark-theme" rules from mixins. gutenberg#33058
 - Adjust widget form margins in the new widget editor gutenberg#33040
 - [Block Library - Query Loop]: Select first Query Loop found from pattern selection gutenberg#32737

See #53397.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 15:53:43 +00:00
desrosj
d5cf36000b Docs: Correct @since annotation for WP_Block_Type->view_script.
Follow up to [51259].

Props swissspidy.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51260


git-svn-id: http://core.svn.wordpress.org/trunk@50869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 15:47:58 +00:00
youknowriad
8e08c569c5 Build: Split packages and blocks to their webpack configs.
This also adds support for the viewScript for blocks fixing 
the PDF preview for file blocks.

Props desrosj, gziolo.
See #53397.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 15:09:58 +00:00
desrosj
fe87833764 Build/Test Tools: Add the artifacts directory to svn-ignore and .gitignore.
When E2E tests fail, test snapshots with more details about the failure are placed in this folder.

Props isabel_brison.
Fixes #53549.
Built from https://develop.svn.wordpress.org/trunk@51258


git-svn-id: http://core.svn.wordpress.org/trunk@50867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 14:45:57 +00:00
Sergey Biryukov
c804143db6 Twenty Seventeen: Avoid JS errors when displaying legacy widgets.
Make sure the `$sidebar` variable is defined and has at least one entry in the array, before adding the `.below-entry-meta` class to elements below the entry meta.

Previously, the theme expected sidebar markup to exist on the page if sidebars are defined, but that markup is missing since only the widget itself and headers/footers of the page are loaded in the iframe used to display legacy widgets (widgets added prior to WordPress 5.8).

Props Clorith, Boniu91, desrosj.
Fixes #53512.
Built from https://develop.svn.wordpress.org/trunk@51257


git-svn-id: http://core.svn.wordpress.org/trunk@50866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 12:57:56 +00:00
Sergey Biryukov
600d611e0d Docs: Improve documentation for wp_should_load_separate_core_block_assets().
This should clarify the purpose of the function and what effect it has on block styles loading.

Props aristath, desrosj, jorbin, SergeyBiryukov.
See #53505.
Built from https://develop.svn.wordpress.org/trunk@51256


git-svn-id: http://core.svn.wordpress.org/trunk@50865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 11:12:02 +00:00
desrosj
186d7c75ea Coding Standards: Apply an alignment fix after composer format.
Follow up to [51254].

See #53375.
Built from https://develop.svn.wordpress.org/trunk@51255


git-svn-id: http://core.svn.wordpress.org/trunk@50864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 00:39:58 +00:00
desrosj
516bc482bd Editor: Prevent block stylesheets from loading when they do not exist.
This fixes an issue where block stylesheets were being loaded even if they did not exist, causing 404 errors. The issue presented itself when the site was choosing to load block assets individually through the `should_load_separate_core_block_assets` filter hook.

This also fixes an issue where non-Core blocks would only be registered if they actually had asset files. This prevents developers from adding additional information to a style handle, such as inline styles through `wp_add_inline_style()`.

Props walbo, jorbin, aristath, desrosj, hellofromTonya.
Fixes #53375.
Built from https://develop.svn.wordpress.org/trunk@51254


git-svn-id: http://core.svn.wordpress.org/trunk@50863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 00:08:57 +00:00
desrosj
fe2bd634e4 Twenty Twenty-One: Ensure Duotone images are displayed correctly in Dark Mode.
This reduces the specificity of the CSS selector applying a dimming effect to images so that the new Duotone feature is properly applied to images.

Props walbo.
Fixes #53531.
Built from https://develop.svn.wordpress.org/trunk@51253


git-svn-id: http://core.svn.wordpress.org/trunk@50862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-28 23:40:59 +00:00
Clorith
87a427d3f0 Site Health: Improve readability of site titles.
This splits up the site title for the Site Health tabs to make it more obvious what page a user is viewing, and which tab under that page. It also removes a possible source of warnings if a user tries accessing a tab that does not exist.

The introduction of this check for existing tabs also improves the accuracy of the active-tab indicator, ensuring the indicator shows up for the default tab, when no other tab has been selected.

Follow-up to [50764].

Props audrasjb, swissspidy.
Fixes #53535.
Built from https://develop.svn.wordpress.org/trunk@51252


git-svn-id: http://core.svn.wordpress.org/trunk@50861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-28 23:07:57 +00:00
desrosj
ccdb1766ae Themes: Remove mention of “FSE” in Core.
Props aristath, jorbin.
Fixes #53497.
Built from https://develop.svn.wordpress.org/trunk@51251


git-svn-id: http://core.svn.wordpress.org/trunk@50860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-28 19:11:57 +00:00
youknowriad
687fcda03f Block Editor: Package updates including fixes from Gutenberg for WordPress 5.8 RC1.
This includes the fixes from https://github.com/WordPress/gutenberg/pull/33036

See #53397.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-28 16:01:36 +00:00
Sergey Biryukov
6311baa859 Docs: Update documentation for WP_Widget_Block per the documentation standards.
Remove unused `$post` global reference.

Follow-up to [50995], [51058], [51063], [51221].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51249


git-svn-id: http://core.svn.wordpress.org/trunk@50858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-28 08:35:57 +00:00
noisysocks
7131a90b0a Widgets REST API: Fix non-multi widgets not appearing in wp_inactive_widgets
Registered widgets that do not extend WP_Widget should appear in the
wp_inactive_widgets sidebar by default. Having the widgets REST API call
retrieve_widgets() before serving any request ensures that this will happen.

This is a similar fix to [51235].

Fixes #53534.
Props zieladam, timothyblynjacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-28 04:34:57 +00:00
Clorith
c26143ea2e Site Health: Add a unique wrapper for dashboard widget content.
This wraps the inner-content of the Site Health dashboard widget to give a unique target for CSS selectors, restoring the ability to collapse the widget.

The initial implementation targeted the `.inside` class used by all widgets to apply styling to the widget content, but this prevented the widget from being collapsed, as it added grid-styles which other widgets do not use, overriding the usual behavior when toggling widget visibility.

Follow-up to [50833].

Props alanjacobmathew, walbo.
Fixes #53521.
Built from https://develop.svn.wordpress.org/trunk@51247


git-svn-id: http://core.svn.wordpress.org/trunk@50856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-27 15:56:58 +00:00
Sergey Biryukov
d18f86031a General: Ensure svn:eol-style is consistently set for all recently added files.
Follow-up to [49135], [49226], [49320], [49478], [49574], [51198].

Fixes #53528.
Built from https://develop.svn.wordpress.org/trunk@51246


git-svn-id: http://core.svn.wordpress.org/trunk@50855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-27 12:46:01 +00:00
Sergey Biryukov
2797ef60da Block Editor: Remove empty blocks/query-loop directory.
The Query Loop block was renamed to Post Template.

Follow-up to [51101].

See #52991.
Built from https://develop.svn.wordpress.org/trunk@51245


git-svn-id: http://core.svn.wordpress.org/trunk@50854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-27 11:29:00 +00:00
Sergey Biryukov
bf3ebaf60f Docs: Document api_version and variations properties in WP_Block_Type::__construct().
Add `@since` tags for all properties added in WordPress 5.5, 5.6, and 5.8.

Follow-up to [47875], [48117], [49224], [50297], [50419], [50527].

Props mbabker.
Fixes #53518.
Built from https://develop.svn.wordpress.org/trunk@51244


git-svn-id: http://core.svn.wordpress.org/trunk@50853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-26 11:13:56 +00:00
Aaron Jorbin
792955066f Post WordPress 5.8 Beta 4 version bump.
Built from https://develop.svn.wordpress.org/trunk@51243


git-svn-id: http://core.svn.wordpress.org/trunk@50852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 17:10:58 +00:00
Aaron Jorbin
084092a935 WordPress 5.8 Beta 4.
Built from https://develop.svn.wordpress.org/trunk@51242


git-svn-id: http://core.svn.wordpress.org/trunk@50851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 16:49:57 +00:00
youknowriad
be0d5b2534 Block Editor: Update the packages with a number of fixes targeted for Beta 4.
It includes fixes from these two backport PRs: 

 - https://github.com/WordPress/gutenberg/pull/32992
 - https://github.com/WordPress/gutenberg/pull/32956

Props gziolo, ryelle, ntsekouras, desrosj, jorgefilipecosta.
See #53397

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


git-svn-id: http://core.svn.wordpress.org/trunk@50850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 15:52:22 +00:00
youknowriad
578cda50a2 Block Editor: Do not load a default font family for themes with theme.json.
This matches the behavior that has been in place in the gutenberg plugin.
The idea is that this makes the editor match the frontend by default for these themes.
If they use a custom font, they'll have to provide it for the editor as editor styles.

Props nosolosw.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 15:32:58 +00:00