Commit Graph

18123 Commits

Author SHA1 Message Date
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