Commit Graph

33832 Commits

Author SHA1 Message Date
Sergey Biryukov 98ae9ab132 Tests: Clean up test images in `WP_Customize_Manager` tests.
The test for `WP_Customizer_Manager::import_theme_starter_content()` creates two attachments that remain in the `uploads` directory after the test run is complete.

This commit follows the approach from `WP_REST_Posts_Controller` tests and utilizes an `$attachments_created` property to track any files uploaded in the current test run and clean them up afterwards.

This makes sure there are no leftover images after the test class is run.

Follow-up to [39276], [39346], [39411], [40142], [53935], [54424].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54425


git-svn-id: http://core.svn.wordpress.org/trunk@53984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-09 16:28:30 +00:00
Sergey Biryukov c8257d0821 Tests: Remove unnecessary file copying in `WP_Customize_Manager` tests.
This was added to avoid creating leftover image sub-sizes in the version-controlled `DIR_TESTDATA` directory.

However, this does not appear to be necessary:
* `WP_Customizer_Manager::import_theme_starter_content()` already [source:tags/6.0.2/src/wp-includes/class-wp-customize-manager.php?marks=1370-1374#L1367 makes a copy of the image] before sideloading, so the test was essentially working with a copy of a copy.
* The images were only used in one test out of 70 and do not need to be copied for every single test.

Upon further investigation, there is also no evidence that creating these copies actually resolved the reported issue:
* `WP_UnitTest_Factory_For_Attachment::create_object()` inserts an attachment, but does not create image sub-sizes.
* `media_handle_sideload()` does create image sub-sizes, but the file is already in the media library by that time, and sub-sizes are created in the `uploads` directory, not in the version-controlled `DIR_TESTDATA` directory.

This commit removes ~140 redundant file copying operations when running the test suite.

Follow-up to [39276], [39346], [39411], [40142].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54424


git-svn-id: http://core.svn.wordpress.org/trunk@53983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-09 13:47:31 +00:00
Sergey Biryukov cbe943d1d1 Tests: Add `wp_cache_*_multiple()` functions to Memcached implementation used in the test suite.
Since this object cache implementation was added, WordPress has introduced a variety of caching API improvements:
* `wp_cache_add_multiple()`
* `wp_cache_set_multiple()`
* `wp_cache_get_multiple()`
* `wp_cache_delete_multiple()`

Although WordPress core provides a compatibility layer if these functions are missing from third-party object caches, this commit updates the Memcached object cache used in the test suite to implement these new functions directly.

Follow-up to [40561], [47938], [47944], [52700], [52703], [52706], [52708].

Props petitphp, spacedmonkey, tillkruss, SergeyBiryukov.
Fixes #54864.
Built from https://develop.svn.wordpress.org/trunk@54423


git-svn-id: http://core.svn.wordpress.org/trunk@53982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-08 13:41:13 +00:00
audrasjb 62edbe0bbe Build/Test Tools: Add tests coverage for `_wp_check_alternate_file_names()`.
This changeset adds missing unit tests for this function.

Props pbearne, costdev, peterwilsoncc.
Fixes #55199.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-08 09:18:11 +00:00
audrasjb 0a0f4795bb Build/Test Tools: Add tests for `WP_List_Util::pluck` and `WP_List_Util::sort`.
This changeset adds additional unit tests for these two functions.

Props pbearne, costdev, afragen.
Fixes #55300.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-08 08:46:13 +00:00
audrasjb 22f52c83c2 Build/Test Tools: Add tests for `wp_nonce_field()` and `wp_referer_field()`.
This changeset adds missing unit tests for these two functions.

Props pbearne, costdev, audrasjb.
Fixes #55578.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 22:19:11 +00:00
Weston Ruter 6d7dd31236 Customize: Prevent PHP notice in Customizer when using block theme.
Use the `customize_panel_active` filter to deactivate the Menus panel instead of overriding the `check_capabilities` method. This ensures the panel remains registered but is still hidden.

See #54888.
Fixes #54905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 20:48:12 +00:00
audrasjb d8175f4121 Twenty Twenty: Improve Separator Block rendering.
This changeset fixes inconsistent alignment behavior of the Separator Block in the editor.

Props kmadhak, sabernhardt, mukesh27, nidhidhandhukiya, kajalgohel.
Fixes #55910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 20:42:11 +00:00
Adam Silverstein b0a552657e Media: ensure the `wp_editor_set_quality` filter consistently passes the correct output mime type.
Ensure that the mime type passed to the `wp_editor_set_quality` filter is correct when the output format is altered with the `image_editor_output_format` filter and the image is saved multiple times, for example when generating sub sizes. Previously, the original image mime type was passed instead of the output type after the initial save.

Props flixos90, peterwilsoncc.
Fixes #56442.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 19:17:12 +00:00
Adam Silverstein 2d9ac13f69 Media: improve image engine detection when using the output format filter.
When the output format is altered with the `image_editor_output_format` filter, prefer the image engine that supports both input an output types, falling back to the engine that supports the input type.

Correct an issue where the output format filter wasn't respected because the selected engine didn't support the output format.

Props mikeschroder, ironprogrammer.
Fixes #54476.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 19:03:11 +00:00
Sergey Biryukov 59b066ef11 Blocks: Avoid extra calls to `realpath()` in block scripts and styles registration.
This affects:
* `register_block_script_handle()`
* `register_block_style_handle()`

Both functions set a variable with this code:
{{{
$wpinc_path_norm = wp_normalize_path( realpath( ABSPATH . WPINC ) );
}}}

That value never changes during page load, so we can save it to a static variable. By doing so, we can avoid ~200 calls to `realpath()` and `wp_normalize_path()`, or even more if third-party plugins register scripts or styles.

Follow-up to [52291], [52939], [54290], [54291], [54309], [54327].

Props aristath, mukesh27, SergeyBiryukov.
Fixes #56758.
Built from https://develop.svn.wordpress.org/trunk@54415


git-svn-id: http://core.svn.wordpress.org/trunk@53974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 15:46:12 +00:00
davidbaumwald 8a8bd9192b Administration: Guard against undefined `$GLOBALS['hook_suffix']` in `WP_Screen::get()`.
When initially defaulting the screen `$id` in `WP_Screen::get()`, if the `$hook_name` parameter is not supplied, an `else` fallback uses `$GLOBALS['hook_suffix']`.  However, in some cases, `hook_suffix` doesn't exist in the global scope.  This produces an "Undefined index" notice on < PHP 8, and a warning in >= PHP 8.

This change ensures `$GLOBALS['hook_suffix']` has a value before using it as a fallback for the screen ID.

Props splendorstudio, SergeyBiryukov, htdat, mukesh27, dd32, costdev.
Fixes #49089.
Built from https://develop.svn.wordpress.org/trunk@54414


git-svn-id: http://core.svn.wordpress.org/trunk@53973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 14:25:14 +00:00
audrasjb 6441d199f2 Twenty Nineteen: Ensure Pullquote Block text color is reflected on front-end.
This changeset ensures Pullquote Block text is consistent between the editor a on front-end.

Props nithins53, umesh84, sabernhardt, deepakvijayan, poena.
Fixes #55981.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 12:12:12 +00:00
audrasjb ea2a6daa0b Docs: Various docblock fixes in `global-styles-and-settings.php`, as per documentation standards.
Follow-up to [54408].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 12:09:11 +00:00
audrasjb cd0a4ee190 Docs: Various docblock fixes in `WP_Theme_JSON` class, as per documentation standards.
Follow-up to [54408].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 12:01:13 +00:00
spacedmonkey be3c6666d9 Query: Move call to `update_menu_item_cache` in `WP_Query`
Move call to `update_menu_item_cache` in `WP_Query` to after post meta caches for menu items are primed. 

Props spacedmonkey, peterwilsoncc, mukesh27.
See #55620.
Built from https://develop.svn.wordpress.org/trunk@54410


git-svn-id: http://core.svn.wordpress.org/trunk@53969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 10:00:15 +00:00
jorgefilipecosta 148049329d Fix: cite styles declared via theme.json not working.
Fixes an issue where cite elements declared on theme.json are not being output on the front end of the website.

Props oandregal, carolinan, scruffian.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54409


git-svn-id: http://core.svn.wordpress.org/trunk@53968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 09:46:13 +00:00
audrasjb ae50e2c014 Editor: Add missing `blocks` origin to `theme.json`.
This changeset updates the blocks origin name from core to blocks and adds it to the list of valid origins for `theme.json`.
(See the original fix in [https://github.com//pull/3319 Gutenberg's PR 44363]).

Why?

- This new origin was missing from the list.
- The `core` name is not reflective of what it does, as this data origin is related to block styles, whether they come with WordPress or third-party blocks.
- The existing filter for this piece of data is called `theme_json_blocks`, to reflect it filters "block" data.
- Though `core` origin was used in the past for `default`, this commit reverts it. Why? It was confusing. The goal is to use names that communicate what part of the pipeline are processing (`default > blocks > theme > custom`).

How?

- Renames the string, from `core` to `blocks`.
- Adds `blocks` to the list of valid origins.
- Verifies that the `$theme_json->get_stylesheet()` call uses the proper `$origins` at all times.

Follow-up to [54162], [54251].

Props oandregal, czapla, jorgefilipecosta, scruffian, bernhard-reiter hellofromTonya.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 09:40:13 +00:00
Peter Wilson a1518e3bc4 Build/Test tools: Add tests for `wp_nonce_url()`.
Props pbearne, costdev.
See #55652.
Fixes #54870.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 02:51:10 +00:00
desrosj e26b369fb2 Build/Test Tools: Use `require_once` instead of `require`.
The `sync-stable-blocks.js` file is used to compile the contents of `require-dynamic-blocks.php`, which includes the PHP files required for dynamic Core blocks.

Since these files define PHP functions, `require_once` should be used instead of `require` to guard against fatal errors.

Follow up to [53688].

Props aristath, SergeyBiryukov, desrosj.
Fixes #56738. See #56179.
Built from https://develop.svn.wordpress.org/trunk@54406


git-svn-id: http://core.svn.wordpress.org/trunk@53965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 01:58:11 +00:00
desrosj 7163f9fd3e Bundled Themes: Properly escape URLs.
This adds output escaping to several theme related URLs.

Props alberuni-azad, sabernhardt.
Fixes #56696.
Built from https://develop.svn.wordpress.org/trunk@54405


git-svn-id: http://core.svn.wordpress.org/trunk@53964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 01:34:11 +00:00
desrosj a35232fc60 Twenty Eleven: Pass template directory URLs through `esc_url()`.
Props alberuni-azad, sabernhardt, costdev.
Fixes #56717. See #56696.
Built from https://develop.svn.wordpress.org/trunk@54404


git-svn-id: http://core.svn.wordpress.org/trunk@53963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 01:25:10 +00:00
Sergey Biryukov 646a284e71 Tests: Clean up test image for site icon in `Tests_REST_Server` on teardown.
This makes sure there are no leftover images after the test class is run.

Follow-up to [52080], [53463], [53920].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54403


git-svn-id: http://core.svn.wordpress.org/trunk@53962 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 01:09:11 +00:00
desrosj 5adad0ead8 Tests: Replace some occurrences of `assertEquals()` with `assertSame()`.
This ensures that not only the return values match the expected results, but also that their type is the same.

Props costdev, desrosj.
See #55654.
Built from https://develop.svn.wordpress.org/trunk@54402


git-svn-id: http://core.svn.wordpress.org/trunk@53961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 01:04:11 +00:00
Sergey Biryukov 1d10384608 Tests: Bring some consistency to `WP_Image_Editor_GD` and `WP_Image_Editor_Imagick` tests.
Includes:
* Adjusting test method descriptions and comments per the documentation standards.
* Creating image editor class instances directly, instead of calling `wp_get_image_editor()`.
* Cleaning up temporary files before performing assertions, where possible.
* Using more consistent variable names for image editor class instances.
* Reordering some test methods.

Follow-up to [1182/tests], [1188/tests], [27794], [30549], [30990], [31040], [39580], [40123], [49230], [49488], [49542], [49751].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54401


git-svn-id: http://core.svn.wordpress.org/trunk@53960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 00:42:12 +00:00
desrosj 0edbc3da00 Build/Test Tools: Update npm dependencies to their latest versions.
This updates the following `devDependencies`:

- `chalk` from `5.0.1` to `5.1.0`
- `dotenv` from `16.0.2` to `16.0.3`
- `sinon` from `14.0.0` to `14.0.1`
- `uglify-js` from `3.17.1` to `3.17.3`

This is the final dependency bump for 6.1.

See #56641.
Built from https://develop.svn.wordpress.org/trunk@54400


git-svn-id: http://core.svn.wordpress.org/trunk@53959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-06 18:57:22 +00:00
davidbaumwald 428915d739 Editor: Ensure block styles in `theme.json` are rendered.
This change removes the caching of theme data in `WP_Theme_JSON_Resolver::get_theme_data()`, instead freshly compiling theme data on each call.

Also, to prevent any performance degradation by the removal, the file contents of `theme.json` files are now cached in `WP_Theme_JSON_Resolver::read_json_file()`, preventing multiple filesystem reads.

Follow-up to [54385].

Props ndiego, bph, mikachan, andrewserong, oandregal, cbravobernal, bernhard-reiter, aristath.
Fixes #56736.
Built from https://develop.svn.wordpress.org/trunk@54399


git-svn-id: http://core.svn.wordpress.org/trunk@53958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-06 18:02:10 +00:00
Sergey Biryukov 4943dbf577 Themes: Replace `array_map()` usage in `WP_Theme_JSON::get_default_slugs()`.
When loading a page on the frontend using Xdebug & Webgrind, with the Twenty Twenty-Three theme and no plugins activated, the biggest performance bottleneck currently (on the PHP side) is `WP_Theme_JSON::merge()`. Analysing the data a bit more, it became evident that `WP_Theme_JSON::get_default_slugs()` is the part of that method which takes most of the resources and time.

Further analysis of the method revealed that `array_map()` was the call that slowed it down.

This commit replaces the `array_map()` call with a simple `foreach` loop, improving page load speed significantly.

Follow-up to [52275], [52364].

Props aristath.
Fixes #56745.
Built from https://develop.svn.wordpress.org/trunk@54398


git-svn-id: http://core.svn.wordpress.org/trunk@53957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-06 15:27:13 +00:00
Peter Wilson b879d04354 Users: Revert use of shared objects for current user.
Reverts [50790].

Props oztaser, ravipatel, dd32, costdev, SergeyBiryukov, tykoted, cu121, xknown.
Fixes #54984.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-06 04:38:14 +00:00
Sergey Biryukov 14f891f733 Tests: Add comments to clarify a REST API test for password protected posts.
Authenticated users should only be allowed to read password protected content if they have the `edit_post` meta capability for the post. In other words, the content of a password protected post created by an Editor should not be viewable by a Contributor.

This commit aims to clarify the usage of a negative assertion `assertStringNotContainsString()` and describe the intention behind the test to avoid confusion.

Follow-up to [50717].

Fixes #56681.
Built from https://develop.svn.wordpress.org/trunk@54396


git-svn-id: http://core.svn.wordpress.org/trunk@53955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-05 14:49:13 +00:00
audrasjb 81cbe2c55b General: Add a default `font-style` value for Adminbar links.
If a theme includes a `theme.json` file and sets a specific `font-style` on links, the font-style also changes the links in the WordPress admin bar, when the admin bar is visible on front-end. For example, this happens with the `pitch` style variation of Twenty Twenty-Three.

Using a default value for the `font-style` property prevents `theme.json` files from overriding it.

Props audrasjb, poena.
Fixes #56737.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-05 14:09:11 +00:00
Sergey Biryukov 160d25ed91 Tests: Ignore EOL differences in Style Engine API tests.
Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result.

This resolves two failures when running the test suite on Windows along the lines of:
{{{
1) Tests_Style_Engine_wpStyleEngineCSSRule::test_should_prettify_css_rule_output
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 #Warning: Strings contain different line endings!
-'.baptiste {
-       margin-left: 0;
-       font-family: Detective Sans;
+'.baptiste {
+       margin-left: 0;
+       font-family: Detective Sans;
}'

/var/www/tests/phpunit/tests/style-engine/wpStyleEngineCssRule.php:159
}}}

Follow-up to [46612], [48443], [48466], [49691], [51135], [53282], [53319], [54156].

See #56467, #55652.
Built from https://develop.svn.wordpress.org/trunk@54394


git-svn-id: http://core.svn.wordpress.org/trunk@53953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-05 14:06:15 +00:00
Gary Pendergast 32a7a3b5cd Embeds: Add support for Tumblr Dashboard URLs.
WordPress has supported embedding Tumblr blog network posts since 4.2.0. This commit adds support for embedding posts using Tumblr Dashboard URLs.

Fixes #56733.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-05 00:15:11 +00:00
audrasjb 009cd01c3b Administration: Avoid menu/sub-menu overlap on small screens.
This changeset fixes overlapping glitches discovered in WordPress Admin menu behavior when used on small screens.

Props turtlepod, collieit, chaion07, hilayt24, mehedi890, markparnell, webcommsat, mehedi890, ryokuhi, sabernhardt, ironprogrammer, audrasjb, costdev, ugyensupport.
Fixes #32747.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 23:12:08 +00:00
audrasjb 50309fa1e3 Docs: Various docblock fixes in `WP_Rewrite` class, as per documentation standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 23:01:13 +00:00
davidbaumwald 42552675cc Post WordPress 6.1 Beta 3 version bump.
Built from https://develop.svn.wordpress.org/trunk@54390


git-svn-id: http://core.svn.wordpress.org/trunk@53949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 17:51:14 +00:00
davidbaumwald 7641a389bb WordPress 6.1 Beta 3.
Built from https://develop.svn.wordpress.org/trunk@54389


git-svn-id: http://core.svn.wordpress.org/trunk@53948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 17:27:11 +00:00
davidbaumwald 9fc0351883 Editor: Sync latest `@wordpress/edit-site` package to include dynamic template names updates.
Updates `@wordpress/edit-site` from version 4.14.5 to version 4.14.6.

Follow-up to [54280], [54333], and [54370].

Props bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54388


git-svn-id: http://core.svn.wordpress.org/trunk@53947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 17:03:24 +00:00
davidbaumwald a8af293608 Editor: Fix server-side attribute registration via typography support.
Ensures the `fontFamily` attribute is registered for block types on the server side. This change resolves a `400` error when attempting to change the font family for a server-side rendered block in the editor.

Props aaronrobertshaw, mamaduka, wildworks, upadalavipul.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54387


git-svn-id: http://core.svn.wordpress.org/trunk@53946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 16:47:13 +00:00
desrosj 436bf77300 External Libraries: Update `clipboard` and `polyfill-library`.
This updates the Clipboard.js and `polyfill-library` dependencies to their latest versions (`2.0.11` and `4.4.0`, respectively).

Fixes #56670.
Built from https://develop.svn.wordpress.org/trunk@54386


git-svn-id: http://core.svn.wordpress.org/trunk@53945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 15:55:23 +00:00
davidbaumwald 335ecfdca9 Editor: Invalidate blocks metadata cache when needed in `WP_Theme_JSON::get_blocks_metadata()`.
This change ensures that user-supplied global styles settings for blocks aren't lost due to sanitization.  This could previously occur due to outdated blocks metadata that did not include all registered blocks.

Props jorgefilipecosta, andrewserong, oandregal, talldanwp, cbravobernal, bernhard-reiter, hellofromTonya.
Fixes #56644.
Built from https://develop.svn.wordpress.org/trunk@54385


git-svn-id: http://core.svn.wordpress.org/trunk@53944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 15:50:12 +00:00
Sergey Biryukov 2ede19910a Database: Correct MariaDB version check in `wpdb::has_cap()`.
MariaDB version is reported differently between PHP versions:
* PHP 8.0.16 or later: `10.6.8-MariaDB`
* PHP 8.0.15 or earlier: `5.5.5-10.6.8-MariaDB`

The latter includes PHP 7.4.x and PHP 5.6.x as well, where the version is also reported with the `5.5.5-` prefix.

This commit makes an adjustment to `wpdb::has_cap()` to check for the correct MariaDB version.

This resolves an issue where the `utf8mb4_unicode_520_ci` collation, which is available in MariaDB since version 10.2, was previously not detected correctly.

References:
* [https://github.com/php/php-src/issues/7972 php-src: #7972: MariaDB version prefix 5.5.5- is not stripped]
* [https://github.com/php/php-src/pull/7963 php-src: PR #7963 Fix GH-7932: MariaDB version prefix not always stripped]
* [https://mariadb.com/docs/reference/mdb/collations/utf8mb4_unicode_520_ci/ MariaDB Documentation: utf8mb4_unicode_520_ci]

Follow-up to [37523], [53919].

Props jamieburchell, SergeyBiryukov.
Fixes #54841.
Built from https://develop.svn.wordpress.org/trunk@54384


git-svn-id: http://core.svn.wordpress.org/trunk@53943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 15:41:18 +00:00
davidbaumwald 4de88db482 Editor: Update packages for 6.1 Beta 3.
Package updates for bug and regression fixes:

* @wordpress/annotations: 2.17.3
* @wordpress/block-directory: 3.15.4
* @wordpress/block-editor: 10.0.4
* @wordpress/block-library: 7.14.4
* @wordpress/blocks: 11.16.4
* @wordpress/components: 21.0.4
* @wordpress/core-data: 5.0.4
* @wordpress/customize-widgets: 3.14.4
* @wordpress/data: 7.1.3
* @wordpress/data-controls: 2.17.3
* @wordpress/edit-post: 6.14.4
* @wordpress/edit-site: 4.14.5
* @wordpress/edit-widgets: 4.14.4
* @wordpress/editor: 12.16.4
* @wordpress/format-library: 3.15.4
* @wordpress/interface: 4.16.3
* @wordpress/keyboard-shortcuts: 3.15.3
* @wordpress/list-reusable-blocks: 3.15.4
* @wordpress/notices: 3.17.3
* @wordpress/nux: 5.15.4
* @wordpress/preferences: 2.9.4
* @wordpress/reusable-blocks: 3.15.4
* @wordpress/rich-text: 5.15.3
* @wordpress/server-side-render: 3.15.4
* @wordpress/style-engine: 1.0.3
* @wordpress/viewport: 4.15.3
* @wordpress/widgets: 2.15.4

References:
* [https://github.com/WordPress/gutenberg/pull/44634 Gutenberg PR 44634] – Quote block: stop slash inserter popup showing in citation
* [https://github.com/WordPress/gutenberg/pull/44630 Gutenberg PR 44630] – Query Loop: Fix condition for displaying 'parents' control
* [https://github.com/WordPress/gutenberg/pull/44554 Gutenberg PR 44554] – Hide the Classic block in the Site Editor
* [https://github.com/WordPress/gutenberg/pull/44594 Gutenberg PR 44594] – Fix navigation block console error
* [https://github.com/WordPress/gutenberg/pull/44555 Gutenberg PR 44555] – Theme export: Fix broken spacingScale export
* [https://github.com/WordPress/gutenberg/pull/44580 Gutenberg PR 44580] – Code Block: Add box-sizing to fix inconsistent layout
* [https://github.com/WordPress/gutenberg/pull/44556 Gutenberg PR 44556] – Remove border from Global Styles previews
* [https://github.com/WordPress/gutenberg/pull/44141 Gutenberg PR 44141] – Spacing presets: Modify the styling of the input controls when in unlinked mode in order to better differentiate sides
* [https://github.com/WordPress/gutenberg/pull/44453 Gutenberg PR 44453] – Preserve the generic signature of getEntityRecord and getEntityRecords through currying
* [https://github.com/WordPress/gutenberg/pull/44504 Gutenberg PR 44504] – Theme.json: fix some outline properties doesn't work properly on the editor
* [https://github.com/WordPress/gutenberg/pull/44516 Gutenberg PR 44516] – Add style engine to editor tsconfig references
* [https://github.com/WordPress/gutenberg/pull/44523 Gutenberg PR 44523] – Query Loop Block: Rename Query Loop variations allowControls to allowedControls
* [https://github.com/WordPress/gutenberg/pull/44520 Gutenberg PR 44520] – Post Featured Image: Fix application of default border style in editor
* [https://github.com/WordPress/gutenberg/pull/44286 Gutenberg PR 44286] – Post Featured Image: Fix borders after addition of overlay feature
* [https://github.com/WordPress/gutenberg/pull/44482 Gutenberg PR 44482] – Template Editor: Fix crashes due to undefined variables
* [https://github.com/WordPress/gutenberg/pull/44480 Gutenberg PR 44480] – Template Parts: Prevent adding block in post editor or inside post template or content blocks
* [https://github.com/WordPress/gutenberg/pull/44425 Gutenberg PR 44425] – Fix rotated image crop area aspect ratio
* [https://github.com/WordPress/gutenberg/pull/44485 Gutenberg PR 44485] – Fix padding/margin visualizer accuracy
* [https://github.com/WordPress/gutenberg/pull/44569 Gutenberg PR 44569] – Theme.json: Fix some shadow properties that do not work properly in the site editor
* [https://github.com/WordPress/gutenberg/pull/44575 Gutenberg PR 44575] – ToggleGroupControl: Fix unselected icon color
* [https://github.com/WordPress/gutenberg/pull/44526 Gutenberg PR 44526] – TokenInput Field: Try alternative approach to fix screen reader focus issue
* [https://github.com/WordPress/gutenberg/pull/44506 Gutenberg PR 44506] – Edit Post: Optimize legacy post content layout
* [https://github.com/WordPress/gutenberg/pull/44258 Gutenberg PR 44258] – Add layout styles from Post Content block to post editor

Follow-up to [54257] and [54335].

Props czapla, isabel_brison, wildworks, bernhard-reiter, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54383


git-svn-id: http://core.svn.wordpress.org/trunk@53942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 15:06:52 +00:00
hellofromTonya 9017d4beb0 Editor: Add PHPUnit tests for 5.9.0 new functions.
During the 5.9.0 cycle, tests were missed during the porting from Gutenberg to Core for the following functions:

* `_disable_block_editor_for_navigation_post_type()`
* `_disable_content_editor_for_navigation_post_type()`
* `_enable_content_editor_for_navigation_post_type()`
* `wp_filter_global_styles_post()`

This commit adds new test classes for these functions.

Reference:
* [https://github.com/WordPress/gutenberg/blob/release/13.6/phpunit/global-styles-test.php Gutenberg v13.6] for `WP_Global_Styles_Test`
* [https://github.com/WordPress/gutenberg/blob/release/13.6/phpunit/navigation-test.php Gutenberg v13.6] for `WP_Navigation_Test`

Follow-up to [52298], [52145], [52052].

Props antonvlasenko, costdev, ironprogrammer, robinwpdeveloper, hellofromTonya.
Fixes #56266.
Built from https://develop.svn.wordpress.org/trunk@54382


git-svn-id: http://core.svn.wordpress.org/trunk@53941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 14:22:14 +00:00
audrasjb 13b79b4a3b Twenty Sixteen: Improve Pullquote Block text color consistency between editor and front-end.
This changeset ensures the text color selected for the text of the Pullquote Block is reflected on both front-end and on the editor.

Props nithins53, nidhidhandhukiya, audrasjb, sabernhardt, poena.
Fixes #56008.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 08:22:10 +00:00
Peter Wilson ac8cba8791 Docs: Correct docblocks for `get_block_file_template()`.
This corrects the docblock for `get_block_file_template()` and the filters it contains: `pre_get_block_file_template` and `get_block_file_template`.

Prior to this change they were incorrectly documented with the docblocks for `get_block_template()` and its associated filters.

Props felipeelia.
Fixes #55929.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 04:29:08 +00:00
Peter Wilson d7e3d069a1 Security: Additional translations of salt default phrase.
Translate the default salt value "put your unique phrase here" in additional locations in which it is used. This further ensures that the default phrase is considered an error in non-english translations of `wp-config.php`.

Follow-up to [54249].

Props peterwilsoncc, audrasjb, JeffPaul.
Fixes #55937.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 03:59:13 +00:00
Peter Wilson 566caa07ae Administration: Remove private delegation from list tables.
Remove the private delegation from the following classes and function:

* `WP_List_Table`
* `WP_Application_Passwords_List_Table`
* `WP_Comments_List_Table`
* `WP_Links_List_Table`
* `WP_Media_List_Table`
* `WP_MS_Sites_List_Table`
* `WP_MS_Themes_List_Table`
* `WP_MS_Users_List_Table`
* `WP_Plugin_Install_List_Table`
* `WP_Plugins_List_Table`
* `WP_Post_Comments_List_Table`
* `WP_Posts_List_Table`
* `WP_Terms_List_Table`
* `WP_Theme_Install_List_Table`
* `WP_Themes_List_Table`
* `WP_Users_List_Table`
* `_get_list_table()`

This change is to reflect the reality that list tables are very, very, very widely used by extenders and backward compatibility therefore needs to be maintained.

Introduces the filter `wp_list_table_class_name` within `_get_list_table()` to allow extenders to modify the list table returned for custom screens.

Props audrasjb, birgire, costdev, desrosj, faison, johnbillion, jrbeilke, kurtpayne, milana_cap, miqrogroove, nacin, peterwilsoncc, scribu, sergeybiryukov, sirzooro, westonruter, wonderboymusic.
Fixes #18449.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 03:47:15 +00:00
Peter Wilson 336517fab3 Posts, Post types: Prevent `get_page_by_title()` parsing query twice.
In `get_page_by_title()` access the populated `WP_Query::posts` property directly rather than via the `WP_Query::get_posts()` method. This removes unnecessary reprocessing of the query.

Follow up to [54234].

Props david.binda, mukesh27, spacedmonkey.
Fixes #56721.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 03:33:10 +00:00
desrosj e63726d593 External Libraries: Update getID3 to version `1.9.22`.
This updates the getID3 library from version `1.9.21` to `1.9.22`, which contains a number of bug fixes and improvements to PHP 8.1 support.

A full list of changes can be found on GitHub: https://github.com/JamesHeinrich/getID3/compare/v1.9.21...v1.9.22.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 02:08:11 +00:00
desrosj aade6aa5f9 Build/Test Tools: Note the versions of NodeJS and npm supported.
This adds a note to the Getting Started section of the `README.md` file mentioning that NodeJS `14.x` and npm `6.x` is currently required to spin up a development environment.

Props elpanda13gmailcom, robinwpwebdeveloper, jakariaistauk, hztyfoon, seakashdiu, rudlinkon, fuadragib.
Fixes #55903.
Built from https://develop.svn.wordpress.org/trunk@54375


git-svn-id: http://core.svn.wordpress.org/trunk@53934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 01:52:09 +00:00
desrosj 9d727a185d Twenty Seventeen: Update the `scrollTo` jQuery plugin.
This updates the `scrollTo` jQuery plugin included in Twenty Seventeen to the latest version, `2.1.3`.

For a full list of changes in this update, see GitHub: https://github.com/flesler/jquery.scrollTo/compare/2.1.2...v2.1.3.

Props sarahricker, mukesh27, desrosj.
Fixes #56702.
Built from https://develop.svn.wordpress.org/trunk@54374


git-svn-id: http://core.svn.wordpress.org/trunk@53933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 01:43:12 +00:00
desrosj ac5a80451f Build/Test Tools: Update `github-script` action to the latest version.
The latest version of the `actions/github-script` action fixes an issue where passing options to the action would remove any default values not passed (see https://github.com/actions/github-script/pull/293).

This also includes updates to other third-party actions, bringing all third-party versions in Core workflows to their latest versions:
- `actions/cache`
- `actions/setup-node`
- `codecov/codecov-action`

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54373


git-svn-id: http://core.svn.wordpress.org/trunk@53932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 01:27:15 +00:00
desrosj 1ea4bd7f5e Twenty Twenty-Three: Bug fixes and improvements for beta 3.
This brings over the latest bug fixes and improvements ahead of WordPress 6.1 beta 3.

For a full list of changes being included, see the `twentytwentythree` repository on GitHub: ac96e8d545...ca662828b7.

Props mikachan, poena, madhudollu, beafialho, colorful-tones, scruffian, tahmidulkarim, joen, taskotr, zoonini, mayuge, ndiego, collet.
See #56383.
Built from https://develop.svn.wordpress.org/trunk@54372


git-svn-id: http://core.svn.wordpress.org/trunk@53931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 01:12:13 +00:00
desrosj 9bda85099f Build/Test Tools: Display PHPCS results in the GitHub Action logs.
When running PHPCS scans (both for checking coding standards and PHP version compatibility), the results are currently only returned silently in a format that GitHub can consume for contextually annotating any code being flagged.

This changes workflows using PHPCS to also display the results of each scan in the GitHub Action log, making it easier to find and understand what is causing failures.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 00:45:14 +00:00
davidbaumwald f82413b29d Editor: Make template names and descriptions dynamic, again.
In the lead up to 6.1 Beta 2, dynamic titles and descriptions for site editor templates was deemed "feature incomplete" and [54280] was reverted.  After further consideration, this code is being re-merged in preparation for Beta 3, reverting the revert in [54333].

Follow-up to [54280] and [54333].

Props bernie, ntsekouras, jorgefilipecosta, jameskoster, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54370


git-svn-id: http://core.svn.wordpress.org/trunk@53929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-03 16:36:11 +00:00
Sergey Biryukov 91900d2639 Build/Test Tools: Remove PHP 8.1 and 8.2 from allowed failures.
With all known unit test failures now addressed, WordPress 6.1 aims to support PHP 8.1 and 8.2 as much as possible.

While full compatibility with PHP 8.1 and 8.2 is still a work in progress, this commit aims to actively prevent new PHP issues from being introduced in WordPress core.

All remaining known issues are deprecation notices. Please note, a deprecation notice is not an error, but rather an indicator of where additional work is needed for compatibility before PHP 9 (i.e. when the notices become fatal errors). With a deprecation notice, the PHP code will continue to work and nothing is broken.

Follow-up to [49077], [49162], [50299], [51588], [51604], [53922], [54072].

Props jrf, desrosj.
See #55652, #55656, #56009, #56681.
Built from https://develop.svn.wordpress.org/trunk@54369


git-svn-id: http://core.svn.wordpress.org/trunk@53928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-03 16:03:13 +00:00
Sergey Biryukov d83f8e682c Code Modernization: Correct default values in `wp_handle_comment_submission()`.
This affects the following parameters subsequently passed to `wp_new_comment()`:
* `comment_author`
* `comment_author_email`
* `comment_author_url`
* `comment_content`

The default values for these parameters were previously set to `null`, causing PHP 8.1 "null to non-nullable" deprecation notices when running sanitization filters on them via `wp_filter_comment()`.

While the deprecation notices were temporarily silenced in the unit test suite, that caused an unexpected issue in a test for [source:tags/6.0.2/tests/phpunit/tests/comment-submission.php#L202 submitting a comment to a password protected post], where the `$_COOKIE[ 'wp-postpass_' . COOKIEHASH ]` value was no longer unset, as the test stopped any further execution once the deprecation notice was triggered.

Due to how WordPress handles password protected posts, once that value is set, it affects all posts protected with the same password, so this resulted in unintentionally affecting [source:tags/6.0.2/tests/phpunit/tests/rest-api/rest-posts-controller.php#L1866 another test] which happened to use the same password.

These values are all documented to be a string in various related filters, and core also expects them to be a string, so there is no reason for these defaults to be set to `null`. Setting them to an empty string instead resolves the issues.

This commit includes:
* Setting the defaults in `wp_handle_comment_submission()` to an empty string.
* Adding a dedicated unit test to verify the type of these default values.
* Removing the deprecation notice silencing as no longer needed.

Follow-up to [34799], [34801], [51968].

Props jrf, desrosj, mukesh27, SergeyBiryukov.
Fixes #56712. See #56681, #55656.
Built from https://develop.svn.wordpress.org/trunk@54368


git-svn-id: http://core.svn.wordpress.org/trunk@53927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-03 15:22:10 +00:00
davidbaumwald a68841201d Editor: Ensure block script is enqueued, regardless of `ronder_callback`.
Follow-up to [54155].

Props aristath, cbravobernal.
See #56408.
Built from https://develop.svn.wordpress.org/trunk@54367


git-svn-id: http://core.svn.wordpress.org/trunk@53926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-03 14:41:14 +00:00
Sergey Biryukov 16a24b396e Build/Test Tools: Call `wpTearDownAfterClass()` before deleting all data, instead of after.
As of [35186] and [51568], there are two sets of methods used for setup/teardown in the test suite before and after a test class is run:

* `set_up_before_class()` / `tear_down_after_class()`
* `wpSetUpBeforeClass()` / `wpTearDownAfterClass()`. (Note the `wp` prefix, these are WordPress' own methods and are not the same as the native PHPUnit `setUpBeforeClass()` / `tearDownAfterClass()` methods.)

The main difference is that `wpSetUpBeforeClass()` receives the `$factory` argument for ease of use, and both `wpSetUpBeforeClass()` and `wpTearDownAfterClass()` don't need to call `self::commit_transaction()`.

Many tests use the `wpTearDownAfterClass()` method to clean up posts, users, roles, etc. created via `wpSetUpBeforeClass()`. However, due to [source:tags/6.0/tests/phpunit/includes/abstract-testcase.php?marks=88-95#L82 how the method was previously called], this cleanup happened after all data is **already deleted** from the database.

This could cause some confusion when refactoring tests. For example:
{{{
public static function wpTearDownAfterClass() {
	$GLOBALS['_wp_additional_image_sizes'] = self::$_sizes;
}

public static function tear_down_after_class() {
	wp_delete_attachment( self::$large_id, true );
	parent::tear_down_after_class();
}
}}}

At a glance, it seems like these two methods can be combined:
{{{
public static function wpTearDownAfterClass() {
	wp_delete_attachment( self::$large_id, true );

	$GLOBALS['_wp_additional_image_sizes'] = self::$_sizes;
}
}}}
However, that would not work as expected: by the time `wp_delete_attachment()` runs, the attachment ID is no longer in the database, so it returns early, leaving some files in the `uploads` directory.

By calling `wpTearDownAfterClass()` in `WP_UnitTestCase_Base::tear_down_after_class()` before deleting all data, instead of after, we ensure that both of these methods have access to the same data and can be used interchangeably to perform cleanup as necessary.

Additionally, this commit moves the calls to parent methods in `WP_UnitTestCase_Base`:

* `parent::set_up_before_class()` to be the first thing called in `::set_up_before_class()`
* `parent::tear_down_after_class()` to be the last thing called in `::tear_down_after_class()`

This does not have any effect in practice, but brings consistency with how these methods are called in the test suite.

Follow-up to [35186], [35225], [35242], [38398], [39626], [49001], [51568].

Props ironprogrammer, SergeyBiryukov.
Fixes #55918. See #55652.
Built from https://develop.svn.wordpress.org/trunk@54366


git-svn-id: http://core.svn.wordpress.org/trunk@53925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-02 15:13:13 +00:00
Sergey Biryukov 4517e90af4 Tests: Ensure prerequisites are met for draft length tests in `Tests_L10n`.
These three tests for `wp_dashboard_recent_drafts()` would run into a PHP 8.1 "passing null to non-nullable" deprecation for the call to `ltrim()` when the result of `get_edit_post_link()` is passed to `esc_url()`.

Setting a deprecation expectation would not solve this as the returned value would still not match the expected value(s).

The recent drafts list is only displayed on the Dashboard screen for users with the `edit_posts` capability. By setting the current user to Editor, the prerequisites for `wp_dashboard_recent_drafts()` are met, which means the deprecation notice is avoided and the assertions will succeed.

This commit addresses a few errors in the test suite along the lines of:
{{{
1) Tests_L10n::test_length_of_draft_should_be_counted_by_words
ltrim(): Passing null to parameter #1 ($string) of type string is deprecated

/var/www/src/wp-includes/formatting.php:4376
/var/www/src/wp-admin/includes/dashboard.php:657
/var/www/tests/phpunit/tests/l10n.php:449
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [45505], [52253], [52259].

Props jrf, desrosj, SergeyBiryukov.
See #56681, #55652, #55656.
Built from https://develop.svn.wordpress.org/trunk@54365


git-svn-id: http://core.svn.wordpress.org/trunk@53924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-01 15:49:09 +00:00
Sergey Biryukov 446d463a19 Code Modernization: Check the return type of `parse_url()` in `url_to_postid()`.
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 `PHP_URL_HOST` as `$component`, which returns `null` if the URL only has a path. The return value of `parse_url()` was then passed to `str_replace()`, leading to a notice on PHP 8.1:
{{{
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
}}}

Adding validation for the return type value of `parse_url()` prevents that.

This commit addresses a few errors in the test suite along the lines of:
{{{
5) Tests_Rewrite::test_url_to_postid_home_has_path
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

/var/www/src/wp-includes/rewrite.php:503
/var/www/tests/phpunit/tests/rewrite.php:271
/var/www/vendor/bin/phpunit:123
}}}

Includes adding a dedicated unit test for a URL that only has a path.

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

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54364


git-svn-id: http://core.svn.wordpress.org/trunk@53923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-01 03:25:10 +00:00
davidbaumwald 9b493706ef Editor: Cast `theme.json` values to `string` on theme export.
Props glendaviesnz.
See #56684.
Built from https://develop.svn.wordpress.org/trunk@54363


git-svn-id: http://core.svn.wordpress.org/trunk@53922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-30 14:48:12 +00:00
Sergey Biryukov 35fb05f30d Code Modernization: Fix null to non-nullable deprecation in `WP_Theme_JSON::get_property_value()`.
This commit aims to fix errors caused by incorrect usage of the `strncmp()` function inside the `WP_Theme_JSON::get_property_value()` method on PHP 8.1 and above.

Some history of the affected code:
* [50973] introduced the `WP_Theme_JSON::get_property_value()` method.
* [54162] removed the `$default` parameter from the `_wp_array_get()` call in the method.

With the latter change, the default value that is returned if the path does not exist within the array, or if `$array` or `$path` are not arrays, became `null` instead of an empty string. Since `null` would then be unintentionally passed to the `strncmp()` function further in the code, this caused ~35 errors in the test suite along the lines of:
{{{
1) Tests_Blocks_Editor::test_get_block_editor_settings_theme_json_settings
strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated

/var/www/src/wp-includes/class-wp-theme-json.php:1754
/var/www/src/wp-includes/class-wp-theme-json.php:1641
/var/www/src/wp-includes/class-wp-theme-json.php:2066
/var/www/src/wp-includes/class-wp-theme-json.php:1002
/var/www/src/wp-includes/class-wp-theme-json.php:898
/var/www/src/wp-includes/global-styles-and-settings.php:140
/var/www/src/wp-includes/block-editor.php:421
/var/www/tests/phpunit/tests/blocks/editor.php:388
/var/www/vendor/bin/phpunit:123
}}}

This commit includes:
* Restoring the `$default` value for `_wp_array_get()` call.
* Adding an early return if the value is an empty string or `null`.
* Adding a dedicated unit test to ensure that the method returns a string for invalid paths or `null` values.

Follow-up to [50973], [54162].

Props antonvlasenko, jrf, imadarshakshat, SergeyBiryukov.
Fixes #56620.
Built from https://develop.svn.wordpress.org/trunk@54362


git-svn-id: http://core.svn.wordpress.org/trunk@53921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-30 00:40:11 +00:00
audrasjb 1c1e37a8a4 Plugins: Fix Upgrade icon alignment on mobile in Plugins Install screen.
This changeset ensures the upgrade icon is correctly aligned on small screens, in the Plugins Install screen.

Props rajanpanchal2028, mukesh27, robinwpdeveloper.
Fixes #55627.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 20:03:10 +00:00
davidbaumwald 0296dc6d98 Editor: Ensure settings for fluid typography and `spacingScale` are not lost on theme export.
This change adds fluid typography as a valid setting and removes `spacingScale` from the array of presets.

Props glendaviesnz, ramonopoly, tellthemachines.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54360


git-svn-id: http://core.svn.wordpress.org/trunk@53919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 19:45:09 +00:00
davidbaumwald fc0840a5f5 Docs: Add `@since` to `wp_enqueue_classic_theme_styles()` docblock.
Follow-up to [54358].

Props kebbet.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54359


git-svn-id: http://core.svn.wordpress.org/trunk@53918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 19:15:10 +00:00
davidbaumwald 143fd4c1f7 Editor: Reintroduce styles that were removed for classic themes.
After block CSS was merged with `theme.json` styles in [https://github.com/WordPress/gutenberg/pull/34180 Gutenberg PR #34180], this removed some existing, default styling for some elements, including buttons.  This change re-adds the removed styles by enqueueing `classic.css` for classic themes.

Merges [https://github.com/WordPress/gutenberg/pull/44334 Gutenberg PR #44334] into trunk.

Follow-up to [54257].

Props scruffian, oandregal, ramonopoly, aristath, andrewserong, get_dave, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54358


git-svn-id: http://core.svn.wordpress.org/trunk@53917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 18:55:10 +00:00
davidbaumwald 4722fcfca8 Editor: Remove deprecated callable in `WP_Style_Engine` class.
Resolves a `Use of "static" in callables is deprecated` notice in = PHP 8.2 and mark `WP_Style_Engine` as a `final` class that will not be extended.

Follow-up to [54156].

Props ramonopoly, jrf, andrewserong.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54357


git-svn-id: http://core.svn.wordpress.org/trunk@53916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 18:05:09 +00:00
davidbaumwald ded36ac650 Editor: Remove leading whitespace from some translated strings.
Merges [https://github.com/WordPress/gutenberg/pull/44314 Gutenberg PR #44314] into trunk.

Follow-up to [54263] and [54269].

Props kebbet, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54356


git-svn-id: http://core.svn.wordpress.org/trunk@53915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 17:54:09 +00:00
Sergey Biryukov 3f512acb78 Build/Test Tools: Disable process timeout when running PHPUnit tests via Composer.
When running the full test suite locally via `npm run grunt phpunit` or `composer test`, it is not uncommon for the test run to exceed the Composer's default timeout, causing an error in the middle of the test output:
{{{
The process "..." exceeded the timeout of 300 seconds.
}}}

This commit disables the process timeout for the `composer test` command, allowing the test run to complete successfully.

Follow-up to [47881], [51016].

Props ironprogrammer, robinwpdeveloper, SergeyBiryukov.
Fixes #55919.
Built from https://develop.svn.wordpress.org/trunk@54355


git-svn-id: http://core.svn.wordpress.org/trunk@53914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 14:45:10 +00:00
desrosj 0084598e3b External Libraries: Update MediaElement.js to version 4.2.17.
This is a minor bug fix release and the latest in the 4.x branch.

A full list of changes can be found on the library’s GitHub: https://github.com/mediaelement/mediaelement/releases/tag/4.2.17.

While this is not the latest version (the 5.x branch is), further testing needs to be done to confirm compatibility in WordPress. #56320 has been opened to explore this.

Props cdbessig, desrosj.
Fixes #56319.
Built from https://develop.svn.wordpress.org/trunk@54354


git-svn-id: http://core.svn.wordpress.org/trunk@53913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 14:21:11 +00:00
davidbaumwald 6824b4dcbd Docs: Use Latin `C` instead of Cyrillic `С` in docblock for `get_test_theme_version()`.
Follow-up to [48168].

Props kebbet.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54353


git-svn-id: http://core.svn.wordpress.org/trunk@53912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 13:55:09 +00:00
spacedmonkey 3b58a4828d Query: Save excessive cache add and sets in `WP_Query`.
In [53941] database query caching was added to `WP_Query`. However on sites with persistent object caching enabled, this resulted in a high number of unnecessary cache set and adds being run on every request. Caches are not set, if the query cache already exists and is cached. Replace usage of `update_post_caches` with `_prime_post_caches` to ensure that only posts that are not in cache are primed. 

Props spacedmonkey, peterwilsoncc, mukesh27.
See #22176.
Built from https://develop.svn.wordpress.org/trunk@54352


git-svn-id: http://core.svn.wordpress.org/trunk@53911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 10:09:11 +00:00
Sergey Biryukov 70f3a062db I18N: Use correct default value for JavaScript translations path.
The `$path` parameter of some script translation functions had a default value of `null`, even though the parameter is documented as a string.

This commit corrects the default value for `$path` in:
* `WP_Dependency::set_translations()`
* `WP_Scripts::set_translations()`
* `wp_set_script_translations()`

Additionally, this commit removes an `is_string()` check for `$path` in `load_script_textdomain()`. Now that the default value for `$path` in that function has also been corrected to an empty string instead of `null`, that check is no longer necessary, as it would ''hide'' an error which should be ''fixed'' (at the source of the problem) instead.

Follow-up to [54349].

Props jrf, johnjamesjacoby.
See #55967, #55656.
Built from https://develop.svn.wordpress.org/trunk@54351


git-svn-id: http://core.svn.wordpress.org/trunk@53910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 22:19:10 +00:00
Weston Ruter 14b6270285 Build/Test Tools: Remove extraneous `--` from `docker-compose up` command.
This end of command options mark can be erreonously interpreted as an (invalid) container name.

Props westonruter, saggre
Fixes #56550

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


git-svn-id: http://core.svn.wordpress.org/trunk@53909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 21:56:12 +00:00
Sergey Biryukov d3006e8a16 Code Modernization: Use correct default value for JavaScript translations path.
The `$path` parameter of `load_script_textdomain()` had a default value of `null`, but would be passed onto the `untrailingslashit()` function without any input validation, even though the latter explicitly only expects/supports a string input.

This commit changes the default value for `$path` to an empty string, and adds an `is_string()` check before passing the value to `untrailingslashit()` to fix the issue at the point where the invalid input is incorrectly (not) validated.

Note: Changing the `untrailingslashit()` function is outside the scope of this commit.

Includes:
* Adding a dedicated unit test for this issue.
* Correcting the default value for `$path` from `null` to an empty string in a few related methods and functions:
 * `WP_Dependency::set_translations()`
 * `WP_Scripts::set_translations()`
 * `wp_set_script_translations()`
 * `load_script_textdomain()`

This fix also allows to remove a couple of calls to `expectDeprecation()` in unrelated tests.

Fixes an error when running the test suite:
{{{
4) Tests_Dependencies_Scripts::test_wp_external_wp_i18n_print_order
rtrim(): Passing null to parameter #1 ($string) of type string is deprecated

/var/www/src/wp-includes/formatting.php:2782
/var/www/src/wp-includes/l10n.php:1068
/var/www/src/wp-includes/class.wp-scripts.php:605
/var/www/src/wp-includes/class.wp-scripts.php:320
/var/www/src/wp-includes/class.wp-dependencies.php:136
/var/www/src/wp-includes/functions.wp-scripts.php:109
/var/www/tests/phpunit/tests/dependencies/scripts.php:1505
/var/www/tests/phpunit/includes/utils.php:436
/var/www/tests/phpunit/tests/dependencies/scripts.php:1507
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [44169], [44607], [51968].

Props jrf, ocean90, Chouby, swissspidy, lovor, iviweb, meysamnorouzi, DarkoG, oneearth27, SergeyBiryukov.
Fixes #55967. See #55656.
Built from https://develop.svn.wordpress.org/trunk@54349


git-svn-id: http://core.svn.wordpress.org/trunk@53908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 17:33:18 +00:00
audrasjb f8bd8914da Script Loader: Prevent double space between attributes in `WP_Styles` class.
This changeset prevents `<link />` elements to display a double space between attributes when no `title` attribute is provided.

Props elten, audrasjb, whaze, SergeyBiryukov.
Fixes #56675.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 14:59:10 +00:00
audrasjb 525c52c873 Docs: Various docblock fixes in `wp-includes/revision.php`, as per documentation standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 14:47:12 +00:00
Sergey Biryukov 2a81bee262 I18N: Move code out of a translatable string in `register_rest_route()`.
To simplify the string and exclude any parts that don't require translation, `$args` can be moved out of the string and added as a placeholder.

Follow-up to [54339].

See #51986.
Built from https://develop.svn.wordpress.org/trunk@54346


git-svn-id: http://core.svn.wordpress.org/trunk@53905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 14:04:11 +00:00
Sergey Biryukov bb8988e3ec Options, Meta APIs: Prevent excessive `notoptions` key lookups.
When the `notoptions` key does not exist in a persistent object cache, it was requested hundreds of times until the first not-option is written.

This commit improves performance by setting the value to an empty array to prevent non-existent `notoptions` key from triggering multiple key lookups.

Follow-up to [4855], [14515].

Props tillkruess, dd32, spacedmonkey.
Fixes #56639.
Built from https://develop.svn.wordpress.org/trunk@54345


git-svn-id: http://core.svn.wordpress.org/trunk@53904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 13:44:15 +00:00
audrasjb 84729259de Twenty Ten: Escape `get_author_posts_url()` where appropriate in `functions.php` file.
This changeset adds missing escaping to some instances of `get_author_posts_url()` used in Twenty Ten, as per WordPress Coding Standards.

Props hztyfoon, robinwpdeveloper, mukesh27, rudlinkon, SergeyBiryukov, jakariaistauk.
Fixes #56674.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 12:40:15 +00:00
desrosj 27f92a2fdc Build/Test Tools: Remove the `retryAfter` input.
This was included in the original pull request that aimed to add support for `octokit/plugin-retry.js` in `actions/github-scripts`, but was actually removed before being merged.

Follow up to [54342].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54343


git-svn-id: http://core.svn.wordpress.org/trunk@53902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 02:22:09 +00:00
desrosj 489b6b80b4 Build/Test Tools: Update `actions/github-scripts` to the latest version.
This version adds support for `octokit/plugin-retry.js`, which retries requests automatically when `4xx` or `5xx` response codes are returned.

To start, the feature is configured to retry all `4xx` and `5xx` response codes, unless the server identifies as a teapot.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54342


git-svn-id: http://core.svn.wordpress.org/trunk@53901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 01:55:11 +00:00
audrasjb 79d521d784 Twenty Ten: Escape `get_permalink()` where appropriate in `functions.php` file.
This changeset adds missing `esc_url()` to some instances of `get_permalink()` used in Twenty Ten, as per WordPress Coding Standards.

Props hztyfoon, robinwpdeveloper, mukesh27, rudlinkon, fuadragib01.
Fixes #56667.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 22:26:16 +00:00
audrasjb 377db68158 Twenty Eleven: Improve text color consistency of Table Block heading cells and figcaption.
This changeset ensures the text color selected for the text of the Table Block is reflected on the `thead` cells, on the figcaption and on the border below it. It also adds better consistency in headings cells padding.

Props umesh84, mukesh27, multidots1896, sabernhardt.
Fixes #56462.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 21:55:11 +00:00
davidbaumwald 7a15b3353a REST API: Ensure `args` is an array of arrays in `register_rest_route()`.
When calling `register_rest_route()`, the `args` parameter for a route should be an array of arrays.  However, some plugins/themes have passed an array of strings or key-value pairs which produces a PHP warning when `array_intersect_key` is used to filter the array keys based on an allowed list of schema keywords.

This change adds a check of the `args` parameter to ensure it's an array of arrays, presenting a `_doing_it_wrong` if any element of `args` is not an array and restructuring to an array of arrays.  This change also adds a unit test for the incorrect usage described above, expecting that a `_doing_it_wrong` is produced.

Props slaFFik, desrosj, apermo, AndrewNZ, aristath, poena, dovyp, timothyblynjacobs, Hinjiriyo, johnmark8080, nateallen.
Fixes #51986.
Built from https://develop.svn.wordpress.org/trunk@54339


git-svn-id: http://core.svn.wordpress.org/trunk@53898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 20:13:13 +00:00
davidbaumwald 888d01689d Administration: Guard against `false` transient key in `get_cached_events()`.
Inside `WP_Community_Events::get_cached_events()`, `WP_Community_Events::get_events_transient_key()` is used to retrieve the transient key name, based on the user's location.  However, the transient key can potentially return `false`, resulting in a call to `get_site_transient()` with the `$key` being `false`.

This change first attempts to evaluate and guard against a `false` return from `WP_Community_Events::get_events_transient_key()`.  The result is an early `false` return from `WP_Community_Events::get_cached_events()`.

Props malthert, rafiahmedd, audrasjb, costdev.
Fixes #55888.
Built from https://develop.svn.wordpress.org/trunk@54338


git-svn-id: http://core.svn.wordpress.org/trunk@53897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 18:57:13 +00:00
davidbaumwald f99287285d Post WordPress 6.1 Beta 2 version bump.
Built from https://develop.svn.wordpress.org/trunk@54337


git-svn-id: http://core.svn.wordpress.org/trunk@53896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 18:10:08 +00:00
davidbaumwald 46f013b3d6 WordPress 6.1 Beta 2.
Built from https://develop.svn.wordpress.org/trunk@54336


git-svn-id: http://core.svn.wordpress.org/trunk@53895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 17:48:12 +00:00
hellofromTonya cce69f5098 Editor: Update packages for 6.1 Beta 2.
Package updates for bug and regression fixes:

* @wordpress/block-directory: 3.15.3
* @wordpress/block-editor: 10.0.3
* @wordpress/block-library: 7.14.3
* @wordpress/block-serialization-default-parser: 4.17.1
* @wordpress/blocks: 11.16.3
* @wordpress/components: 21.0.3
* @wordpress/compose: 5.15.2
* @wordpress/core-data: 5.0.3
* @wordpress/customize-widgets: 3.14.3
* @wordpress/edit-post: 6.14.3
* @wordpress/edit-site: 4.14.4
* @wordpress/edit-widgets: 4.14.3
* @wordpress/editor: 12.16.3
* @wordpress/format-library: 3.15.3
* @wordpress/interface: 4.16.3
* @wordpress/list-reusable-blocks: 3.15.3
* @wordpress/nux: 5.15.3
* @wordpress/preferences: 2.9.3
* @wordpress/reusable-blocks: 3.15.3
* @wordpress/server-side-render: 3.15.3
* @wordpress/style-engine: 1.0.2
* @wordpress/widgets: 2.15.3

References:
* [https://github.com/WordPress/gutenberg/pull/44233 Gutenberg PR 44233] – Blocks: Fix searching of blocks when description is non-string
* [https://github.com/WordPress/gutenberg/pull/44301 Gutenberg PR 44301] – Block Toolbar: update position when moving blocks
* [https://github.com/WordPress/gutenberg/pull/44334 Gutenberg PR 44334] – Global Styles: Re-add styles that were removed, for classic themes
* [https://github.com/WordPress/gutenberg/pull/44351 Gutenberg PR 44351] – Comments block: Support nested comments settings in the comments blocks
* [https://github.com/WordPress/gutenberg/pull/44448 Gutenberg PR 44448] – Add a correct TS signature for useEntityRecords
* [https://github.com/WordPress/gutenberg/pull/44315 Gutenberg PR 44315] – Pullquote: fix transform to quote crash
* [https://github.com/WordPress/gutenberg/pull/44446 Gutenberg PR 44446] – Fix spacing property generation in flow layout type.
* [https://github.com/WordPress/gutenberg/pull/44408 Gutenberg PR 44408] – Upgrade react-easy-crop to bring in fix for site editor iframe
* [https://github.com/WordPress/gutenberg/pull/44406 Gutenberg PR 44406] – Style engine: kebab case preset slugs in the editor
* [https://github.com/WordPress/gutenberg/pull/44209 Gutenberg PR 44209] – Fixing padding on the post editor when RootPaddingAwareAlignments setting is enabled
* [https://github.com/WordPress/gutenberg/pull/42950 Gutenberg PR 42950] – Popover: fix limitShift logic by adding iframe offset correctly (and a custom shift limiter)
* [https://github.com/WordPress/gutenberg/pull/44337 Gutenberg PR 44337] – Submenu block href only if url is not empty
* [https://github.com/WordPress/gutenberg/pull/44291 Gutenberg PR 44291] – Add role=application to list view to prevent browse mode triggering in NVDA
* [https://github.com/WordPress/gutenberg/pull/44283 Gutenberg PR 44283] – Navigation block: Fix submenu colors for imported classic menus
* [https://github.com/WordPress/gutenberg/pull/44282 Gutenberg PR 44282] – Fix popover stacking in the customize widgets editor
* [https://github.com/WordPress/gutenberg/pull/44247 Gutenberg PR 44247] – Spacing presets: switch to using numbers instead of t-shirt sizes for labels
* [https://github.com/WordPress/gutenberg/pull/44299 Gutenberg PR 44299] – Backport template creation changes from core
* [https://github.com/WordPress/gutenberg/pull/44294 Gutenberg PR 44294] – [Block Library - Query Loop]: Fix broken preview in specific category template
* [https://github.com/WordPress/gutenberg/pull/44287 Gutenberg PR 44287] – [Block Library]: Rename Comments pagination inner blocks
* [https://github.com/WordPress/gutenberg/pull/44256 Gutenberg PR 44256] – Avoid showing the recursion warning in previews when replacing template parts
* [https://github.com/WordPress/gutenberg/pull/44265 Gutenberg PR 44265] – Blocks: officially deprecated the children and node matchers
* [https://github.com/WordPress/gutenberg/pull/44251 Gutenberg PR 44251] – Global styles: Remove the beta label from global styles header

Props bernhard-reiter, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54335


git-svn-id: http://core.svn.wordpress.org/trunk@53894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 17:32:52 +00:00
davidbaumwald fe346c1464 Comments: Prevent AYS prompt when replying to a comment and nothing has been entered.
When replying to a comment and nothing has yet been entered for the reply content, clicking "Reply" or "Quick Edit" on another comment presents the "Are you sure..." prompt indicating there are unsaved changes in the reply content.  However, if nothing is entered, this prompt should not be displayed.

This change implements a new check to determine if any text has been entered by the user before deciding to show the "Are you sure..." prompt.

Props cu121, mkox, azouamauriac, hasanuzzamanshamim, pls78, faisal03, rafiahmedd.
Fixes #54990.
Built from https://develop.svn.wordpress.org/trunk@54334


git-svn-id: http://core.svn.wordpress.org/trunk@53893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 17:06:09 +00:00
davidbaumwald bed72ed20d Editor: Revert dynamic template names and descriptions.
After discussions with the Editor Tech leads for 6.1(@bernhard-reiter, @cbravobernal, and @ndiego) and additional guidance from @hellofromtonya, the decision has been made to exclude [https://github.com/WordPress/gutenberg/pull/43862 Gutenberg PR #43862] from the pre-Beta 2 Gutenberg sync PR and revert [54280]. Why? [54280] added the feature's PHP code, but the JS package updates were not included before feature freeze(Beta 1), meaning the feature was incomplete. As the PHP code does not work without the JS package update, the feature is incomplete and missed the feature freeze deadline.

Leaving the PHP code was discussed. However, there is a risk of it needing to change which could complicate backwards compatibility in 6.2 when the feature is eventually introduced.

Follow-up to [54280].

Props hellofromTonya, bernhard-reiter, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54333


git-svn-id: http://core.svn.wordpress.org/trunk@53892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 16:33:10 +00:00
Sergey Biryukov cd0ae0eb85 Bootstrap/Load: Revert the `is_*_admin_screen()` aliases for `is_*_admin()` function family.
After some further discussion, it is apparent that the added clarity was subjective, and the `_screen` suffix may not always be appropriate, e.g. in Ajax context. To address any confusion with the existing names, the documentation for these functions can be updated instead.

Additionally, the `is_super_admin_user()` alias for `is_super_admin()` is reverted as well, which may be reconsidered in the future.

Follow-up to [54259].

Props azaozz, jrf, johnbillion, manfcarlo, Clorith.
See #56400.
Built from https://develop.svn.wordpress.org/trunk@54332


git-svn-id: http://core.svn.wordpress.org/trunk@53891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 16:31:10 +00:00
Sergey Biryukov 33d7ee09f4 Tests: Update block registration tests to account for RTL stylesheet loading changes.
The RTL data should only be added in `register_block_style_handle()` if an RTL locale is selected, so these test expectations do not appear to be correct.

Follow-up to [49982], [53091], [54330].

See #56325.
Built from https://develop.svn.wordpress.org/trunk@54331


git-svn-id: http://core.svn.wordpress.org/trunk@53890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 16:10:09 +00:00
Sergey Biryukov 12b190eb17 Editor: Correctly load RTL stylesheets in `register_block_style_handle()`.
When setting an RTL language under Settings → General, some RTL stylesheets were not loaded, with LTR stylesheets being loaded instead, meaning that some blocks were not displayed correctly.

This commit ensures that all appropriate RTL stylesheets are loaded when selecting an RTL language.

Additionally, this commit improves performance by only running a `file_exists()` check for an RTL stylesheet if `is_rtl()` returns true, i.e. an RTL locale is selected.

Follow-up to [49982], [50836].

Props zoonini, sabernhardt, maahrokh, ankit-k-gupta, aristath, poena, SergeyBiryukov.
See #56325.
Built from https://develop.svn.wordpress.org/trunk@54330


git-svn-id: http://core.svn.wordpress.org/trunk@53889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 15:43:09 +00:00
Sergey Biryukov abf66fa018 Users: Correctly pass the `context` property for persisted preferences.
The user meta `context` property in `wp_register_persisted_preferences_meta()` was incorrectly configured. It should be part of the `schema` array, not the `show_in_rest` array.

Follow-up to [54182].

Props talldanwp, dd32.
Fixes #56665. See #56467.
Built from https://develop.svn.wordpress.org/trunk@54329


git-svn-id: http://core.svn.wordpress.org/trunk@53888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 15:23:10 +00:00
desrosj 3ed1ed5c13 External Libraries: Update Underscore.js to version `1.13.6`.
There are no code changes to the library in this release.

Updating to the latest version for WordPress 6.1 ensures security scanners do not incorrectly flag sites as potentially insecure for having out of date libraries.

Fixes #56030.
Built from https://develop.svn.wordpress.org/trunk@54328


git-svn-id: http://core.svn.wordpress.org/trunk@53887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 15:18:25 +00:00
Sergey Biryukov 6dfd98cfe0 Blocks: Remove extra `get_theme_file_path()` calls in `register_block_style_handle()`.
The `register_block_style_handle()` function runs ~200 times on each page load. Each time it runs, we call `get_theme_file_path()` and then run it through `wp_normalize_path()`.

`get_theme_file_path()` calls a few other functions: `get_stylesheet_directory()`, `get_stylesheet()`, `get_option()`, and there's a bunch of filters that run on each iteration of that, without ever changing.

By caching the value in a static variable, we can avoid ~200 calls on many functions and filters, improving performance.

Follow-up to [53091], [54290], [54291], [54309].

Props aristath, mukesh27.
Fixes #56666.
Built from https://develop.svn.wordpress.org/trunk@54327


git-svn-id: http://core.svn.wordpress.org/trunk@53886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 15:11:14 +00:00
audrasjb b0ebbf6beb Upgrade/Install: Keep search engine checkbox value when reloading the Install screen.
This changeset ensures the value of the search engine checkbox is not reset to its default value when a faulty form is sent in the Install screen.

Props ramon-fincken, audrasjb, whaze, rafiahmedd, khokansardar, costdev, ankit-k-gupta.
Fixes #55900.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 10:37:13 +00:00
audrasjb 2c8c3fed63 Site Health: Fix incorrect message about the status of `WP_AUTO_UPDATE_CORE`.
Previously, the Site Health message said "The WP_AUTO_UPDATE_CORE constant is defined and enabled" when in fact the constant was defined and disabled using `define( 'WP_AUTO_UPDATE_CORE', false );`.

This changeset improves the message by providing the value of the constant. For example: "The WP_AUTO_UPDATE_CORE constant is defined as false".

Props johnbillion, chrisbudd1, robinwpdeveloper, audrasjb, Clorith.
Fixes #51041.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 10:18:12 +00:00
audrasjb 32cefdce56 Docs: Use third-person singular verbs in `class-wp-site-health-auto-updates.php`, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 10:16:22 +00:00
gziolo 8cb2e8aa60 Blocks: Fix 404 error for core styles with no file
[54155] broke loading of style.css files, namely it was enqueuing style.css files that don't exist on the frontend, which lead to 404 HTTO errors. All these style.css files don't exist for core blocks as they should be registered style handlers without a file path.

Follow-up to [54155].
Props tobiasbg, nendeb55.
Fixes #56408, #56614.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 07:40:11 +00:00
Peter Wilson 8364c68daa Security: Introduce strings to indicate support status.
Add strings for use in future maintenance/security releases to indicate the security support status of the version of WordPress.

Two strings are introduced:

* indicating the version of WordPress is not receiving security updates, and,
* indicating the version of WordPress will shortly stop receiving security updates.

This change does not make use of the strings, the purpose is to make them available to translators prior to dropping support of selected versions of WordPress.

Props costdev, chesio, robinwpdeveloper, desrosj, rudlinkon, mukesh27, sumitbagthariya16.
See #56532.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 06:12:13 +00:00
Sergey Biryukov ce8fb38739 Code Modernization: Fix null to non-nullable deprecations in `wp_xmlrpc_server::_insert_post()`.
The `wp_xmlrpc_server::_insert_post()` method creates a new post via `wp_insert_post()` or updates an existing one via `wp_update_post()`, which subsequently calls `wp_insert_post()`. However, the default/fallback values used in the function were not in line with the default/fallback values used in the `wp_insert_post()` function.

The `wp_insert_post()` function does a `wp_parse_args()` (array merge) of the received arguments with the defaults. If any of the received arguments are `null`, this would overwrite the default value, as seen in [https://3v4l.org/bfVlv array_merge() example], and lead to "passing null to non-nullable" deprecation notices on PHP 8.1 for certain arguments.

Unfortunately, the conditional logic within the `wp_xmlrpc_server::_insert_post()` function itself often uses an `isset()` to trigger certain code blocks, so syncing the defaults with those used in the `wp_insert_post()` function was not an option.

This commit:
* Updates the default/fallback values in the `$defaults` array only for those values where this would not lead to a change in the behavior of the function.
* Adds a safeguard function, filtering out all remaining `null` values from the `$post_data` array before it is passed on to the `wp_insert_post()` or `wp_update_post()` functions. Removing those values is safe as this means that these array keys will now:
 * either be set to the default/fallback value as defined in `wp_insert_post()`.
 * or not be set and for those values which don't have a default/fallback value in `wp_insert_post()`, the function does an `! empty()` or `isset()` check anyway and those array keys not being defined means that the result of those checks will remain the same.

Includes
* Removing a couple of conditions which are now redundant.
* Removing an `expectDeprecation()` in the `Tests_Date_XMLRPC` test class, which is now no longer needed.

Fixes various errors along the lines of:
{{{
36) Tests_XMLRPC_wp_newPost::test_no_content
json_decode(): Passing null to parameter #1 ($json) of type string is deprecated

/var/www/src/wp-includes/kses.php:2074
/var/www/src/wp-includes/class-wp-hook.php:307
/var/www/src/wp-includes/plugin.php:205
/var/www/src/wp-includes/post.php:2835
/var/www/src/wp-includes/post.php:2720
/var/www/src/wp-includes/post.php:4066
/var/www/src/wp-includes/class-wp-xmlrpc-server.php:1683
/var/www/src/wp-includes/class-wp-xmlrpc-server.php:1347
/var/www/tests/phpunit/tests/xmlrpc/wp/newPost.php:25
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [1563], [4793], [7900], [16824], [19848], [19873], [20632], [40677], [51968], [54320].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 02:18:10 +00:00
Sergey Biryukov 6746d64fd4 Code Modernization: Fix null to non-nullable deprecations in `wp_xmlrpc_server::mw_newPost()`.
The `wp_xmlrpc_server::mw_newPost()` method creates a new post via `wp_insert_post()`, but the default/fallback values used in the function were not in line with the default/fallback values used in the `wp_insert_post()` function.

The `wp_insert_post()` function does a `wp_parse_args()` (array merge) of the received arguments with the defaults. If any of the received arguments are `null`, this would overwrite the default value, as seen in [https://3v4l.org/bfVlv array_merge() example], and lead to "passing null to non-nullable" deprecation notices on PHP 8.1 for certain arguments.

This commit:
* Ensures that all arguments are defined before they are `compact()`'ed together to the arguments array.
* Verifies that the default/fallback value of the arguments as set within the `wp_xmlrpc_server::mw_newPost()` method are the same as the default/fallback values used in the `wp_insert_post()` function.
* Verifies that arguments which do not have a default/fallback value defined in the `wp_insert_post()` function are handled correctly.
 * This was not the case for `$post_name`, which would previously already get an empty string default value in the `wp_xmlrpc_server::mw_newPost()` function, but then in the `wp_insert_post()` function, this would prevent the slug generation from being activated. Fixed now by setting the default in the `wp_xmlrpc_server::mw_newPost()` function to `null`.
 * The `page_template` argument was handled, but not documented in the `wp_insert_post()` function. The argument is now documented in the `wp_insert_post()` function DocBlock. Note: There are more than likely several other potential arguments missing from that list, but verifying the whole list is outside the scope of this particular commit.

Includes minor simplifications, such as:
* Setting a default ahead of an `if`, instead of in an `else` clause (as long as no function call is needed to set the default).
* Removing the unnecessary logic duplication in the `$post_status` switch.
* Using a combined concatenation + assignment operator for adding `$post_more`.

Fixes various errors along the lines of:
{{{
1) Tests_XMLRPC_mw_editPost::test_draft_not_prematurely_published
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

/var/www/src/wp-includes/formatting.php:2497
/var/www/src/wp-includes/class-wp-hook.php:308
/var/www/src/wp-includes/plugin.php:205
/var/www/src/wp-includes/post.php:2835
/var/www/src/wp-includes/post.php:2720
/var/www/src/wp-includes/post.php:4066
/var/www/src/wp-includes/class-wp-xmlrpc-server.php:5616
/var/www/tests/phpunit/tests/xmlrpc/mw/editPost.php:315

...

23) Tests_XMLRPC_mw_editPost::test_draft_not_prematurely_published
json_decode(): Passing null to parameter #1 ($json) of type string is deprecated

/var/www/src/wp-includes/kses.php:2074
/var/www/src/wp-includes/class-wp-hook.php:307
/var/www/src/wp-includes/plugin.php:205
/var/www/src/wp-includes/post.php:2835
/var/www/src/wp-includes/post.php:2720
/var/www/src/wp-includes/post.php:4066
/var/www/src/wp-includes/class-wp-xmlrpc-server.php:5615
/var/www/tests/phpunit/tests/xmlrpc/mw/editPost.php:315
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [1563], [4793], [7900], [16824], [19848], [40677], [51968].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 02:00:09 +00:00
davidbaumwald b266a2d535 Shortcodes: Revert recent `apply_shortcodes` and `do_shortcode` changes.
[54248] reversed the wrapping of `do_shortcode` and `apply_shortcodes` and updated all direct internal calls of `do_shortcode` to `apply_shortcodes` after [47004].  After further consideration, the long history of `do_shortcodes` should be favored over any subjective semantic improvements.  This change reverts the remaining changes from #55883 not already reverted in [54278].

Follow-up to [47004], [54248], and [54278].

Props azaozz, jorbin.
See #55883.
Built from https://develop.svn.wordpress.org/trunk@54319


git-svn-id: http://core.svn.wordpress.org/trunk@53878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 22:43:10 +00:00
John Blackbourn 2eabdd1490 Docs: Increase the specificity of various property documentation.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 22:10:16 +00:00
hellofromTonya d7893c3cea Code Modernization: Fix null to non-nullable deprecation in `WP_REST_Users_Controller::update_item()`.
Not all requests are accompanied by a `$request['email']`. This leads to a PHP 8.1 "passing null to non-nullable" deprecation notice when the `WP_REST_Users_Controller::update_item()` method passes a `null` email address onto `email_exists()`, which eventually reached the `WP_User::get_data_by()` method where things go wrong.

In the next condition in the code of the `WP_REST_Users_Controller::update_item()` method - `if ( $owner_id && $owner_id !== $id )` - you can see that the code already takes this into account as it will not throw a `WP_Error` if `$owner_id` is falsey.

`WP_User::get_data_by()` returns `false` for a failed field request. The other functions through which the return value is passed through, do the same.

So, by setting a default value for `$owner_id` of `false` and only checking `email_exists()` when there is an email to check, the "passing null to non-nullable" deprecation notice is bypassed without breaking BC.

Fixes a whole slew of test errors along the lines of:
{{{
6) WP_Test_REST_Users_Controller::test_update_item_en_US_locale
trim(): Passing null to parameter https://github.com/WordPress/wordpress-develop/pull/1 ($string) of type string is deprecated

/var/www/src/wp-includes/class-wp-user.php:211
/var/www/src/wp-includes/pluggable.php:105
/var/www/src/wp-includes/user.php:1953
/var/www/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:728
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:1143
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:990
/var/www/tests/phpunit/includes/spy-rest-server.php:67
/var/www/tests/phpunit/tests/rest-api/rest-users-controller.php:1719
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [44641], [38832].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 21:46:09 +00:00
audrasjb d6e06921a8 Menus: Remove bulk action checkboxes when menu is empty.
This changeset removes the bulk action checkboxes when there is no menu item to select.

Follow-up to [51006], [51539].

Props oglekler, krishaweb, costdev, Boniu91, hugodevos, audrasjb.
Fixes #54799.
See #21603, #53654.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 21:44:09 +00:00
audrasjb fd8b414c5f i18n: Ensure empty strings are consistently translated to `''`.
This changeset fixes an edge case where empty strings were wrongly translated to `'0'` (falsey value) instead of `''` (empty string).

Props Chouby, manooweb, rafiahmedd, lopo.
Fixes #55941.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 20:56:10 +00:00
audrasjb 457f15283a Twenty Twenty: Ensure the fallback fonts is applied to all content elements for non-latin languages.
This changeset adds missing CSS selectors to `get_non_latin_css()` function.

Props sabernhardt, audrasjb.
Fixes #56396.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 20:31:10 +00:00
desrosj f15654e0d4 Build/Test Tools: Remove unnecessary `--no-interaction` option from Composer commands.
As of version `2.17.0` of the `shivammathur/setup-php` action, the `COMPOSER_NO_INTERACTION` environment variable is configured by default. `—-no-interaction` will always be used.

Props jrf, hellofromTonya, SergeyBiryukov, costdev, desrosj.
Fixes #54695.
Built from https://develop.svn.wordpress.org/trunk@54313


git-svn-id: http://core.svn.wordpress.org/trunk@53872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 19:17:09 +00:00
desrosj 906280f933 Twenty Twenty-Three: Bug fixes and improvements for beta 2.
This brings over the latest bug fixes and improvements ahead of WordPress 6.1 beta 2, which includes an additional style variation, “Aubergine”.

For a full list of changes being included, see the `twentytwentythree` repository on GitHub: 1b97bb83f1...ac96e8d545.

Props mikachan, poena, madhudollu, critterverse, beafialho, felipeelia.
See #56383.
Built from https://develop.svn.wordpress.org/trunk@54312


git-svn-id: http://core.svn.wordpress.org/trunk@53871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 18:34:14 +00:00
hellofromTonya 26b2f466f4 Editor: Fix spacing property generation in flow layout type.
Fixes a bug of invalid CSS value when applying block spacing to a block as reported in [https://github.com/WordPress/gutenberg/issues/44435 Gutenberg issue 44435].

Adds logic to convert preset values (i.e. `$gap_value`) into valid CSS custom properties for the flow ('default') layout type. See the original fix in [https://github.com/WordPress/wordpress-develop/pull/3324 Gutenberg PR 3324].

Also adds a test dataset that fails before the bugfix and passes after the bugix.

Follow-up to [54274].

Props ndiego, isabel_brison, ramonopoly, andrewserong, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54311


git-svn-id: http://core.svn.wordpress.org/trunk@53870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 14:58:12 +00:00
Sergey Biryukov 2d3bea434b Upgrade/Install: Update sodium_compat to v1.19.0.
The latest version of sodium_compat includes improved compatibility with the PHP 8.0 named parameters functionality.

Release notes:
https://github.com/paragonie/sodium_compat/releases/tag/v1.19.0

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

Follow-up to [49741], [51002], [51591], [52988], [54150].

Props jrf, paragoninitiativeenterprises.
Fixes #56653.
Built from https://develop.svn.wordpress.org/trunk@54310


git-svn-id: http://core.svn.wordpress.org/trunk@53869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 14:00:10 +00:00
Sergey Biryukov aaffa2bcff General: Remove `file_exists()` checks after calling `realpath()`.
`realpath()` already checks if the file exists, and returns `false` on failure. The additional `file_exists()` check is not necessary and can be removed, improving the performance.

This commit simplifies the checks in two functions:
* `register_block_type_from_metadata()`
* `wp_json_file_decode()`

Note: In both of these cases, the values are passed through `wp_normalize_path()` after `realpath()`, so if the file does not exist, the `false` value gets converted to an empty string. The updated checks work both for `false` and `''` values.

Though this is a small tweak, it saves a lot of checks since one of the places we do this is when registering block styles, so it runs quite a few times on each page load.

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

Follow-up to [51599], [54132], [54290], [54291].

Props aristath.
Fixes #56654.
Built from https://develop.svn.wordpress.org/trunk@54309


git-svn-id: http://core.svn.wordpress.org/trunk@53868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 13:07:14 +00:00
gziolo ec8368e14c Tools: Simplify syncing core blocks from Gutenberg plugin to Core
Follow-up [53688].

Removes the hardcoded list of blocks that should be synced from the Gutenberg plugin. webpack reads all information from the `@wordpress/block-library` by scanning `block.json` files.

Props zieladam, azaozz.
Fixes #56179.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 11:42:13 +00:00
gziolo b92a407e22 Tools: Fix running `build` scripts on Windows does not generate CSS files for blocks
Starting with WordPress 6.0, when running `npm run build` or `npm run build:dev`, no CSS files were generated for the blocks within `wp-includes/blocks/**`.

Props wildworks, clorith, sergeybiryukov.
Fixes #56616.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 11:22:10 +00:00
jorgefilipecosta 5e32e7de29 Fix: Revert [54305].
This commit caused an incompatibility with the latest released Gutenberg version.

Props bernhard-reiter.
Built from https://develop.svn.wordpress.org/trunk@54306


git-svn-id: http://core.svn.wordpress.org/trunk@53865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 10:17:11 +00:00
jorgefilipecosta 7882623807 Editor: Fix missing frontend section presets output.
Backports PHP changes in WordPress/gutenberg#42124 to the core. Adds the missing mechanism to output frontend styles of block level presets to the core.

Props mcsf, oandregal, dmsnell, draganescu.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54305


git-svn-id: http://core.svn.wordpress.org/trunk@53864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 09:08:21 +00:00
Sergey Biryukov 44e2aebd03 Tests: Revert removing empty directory in `WP_UnitTestCase_Base::rmdir()` for now.
This appears to need more investigation. Instead, delete the `test-plugin` and `link-manager` directories in REST API plugins controller tests, for which this change was initially intended.

Follow-up to [54300], [54301], [54303].

See #55652, #56629.
Built from https://develop.svn.wordpress.org/trunk@54304


git-svn-id: http://core.svn.wordpress.org/trunk@53863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 04:49:10 +00:00
Sergey Biryukov dc65565f76 Tests: Remove nested empty directories in `WP_UnitTestCase_Base::rmdir()`.
Includes:
* Checking if the directory exists and returning early otherwise.
* Removing a redundant `rmdir()` call in `clean_dirsize_cache()` tests.

Follow-up to [49744], [54300].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54303


git-svn-id: http://core.svn.wordpress.org/trunk@53862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 03:40:09 +00:00
Sergey Biryukov 9fc5df7da5 Coding Standards: Remove extra space in REST API plugins controller test class.
This fixes a WPCS error:

* `Tabs must be used to indent lines; spaces are not allowed`

Follow-up to [54301].

See #56629.
Built from https://develop.svn.wordpress.org/trunk@54302


git-svn-id: http://core.svn.wordpress.org/trunk@53861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 02:53:10 +00:00
Sergey Biryukov b23baf4ce7 Tests: Delete Link Manager plugin after running REST API plugins controller tests.
After running the multisite PHPUnit test suite, the following files remained, contributing towards a dirty working copy:
{{{
tests/phpunit/data/plugins/link-manager/link-manager.php
tests/phpunit/data/plugins/link-manager/readme.txt
}}}
These files should be deleted after running the tests.

This commit ensures the `link-manager` plugin is deleted during test tear down, which was previously done at the beginning of some test methods, but not afterwards.

Follow-up to [48242], [54300].

Props ironprogrammer.
Fixes #56629.
Built from https://develop.svn.wordpress.org/trunk@54301


git-svn-id: http://core.svn.wordpress.org/trunk@53860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 02:43:10 +00:00
Sergey Biryukov 24838999e6 Tests: Remove empty directory in `WP_UnitTestCase_Base::rmdir()`.
The `WP_UnitTestCase_Base::rmdir()` method selectively deletes files from a directory, skipping any paths from the `$ignore_files` property.

This commit updates the method to remove the empty directory if there are no files left, bringing some parity with PHP native `rmdir()` function.

Follow-up to [677/tests], [29120].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54300


git-svn-id: http://core.svn.wordpress.org/trunk@53859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 02:39:14 +00:00
Sergey Biryukov 3d245c574e General: Correct the fallback logic in `apache_mod_loaded()`.
If the `apache_get_modules()` function is redeclared to return an empty array, `apache_mod_loaded()` would assume that no Apache modules are installed and activated, which may not be correct.

This commit improves the logic by using pre-existing `phpinfo()` fallback to check for loaded modules in that case.

Includes replacing a hardcoded number passed as a flag to `phpinfo()` with the `INFO_MODULES` predefined constant for clarity.

Follow-up to [7441], [7508], [29330].

Props engahmeds3ed, audrasjb, Clorith, SergeyBiryukov.
Fixes #56010.
Built from https://develop.svn.wordpress.org/trunk@54299


git-svn-id: http://core.svn.wordpress.org/trunk@53858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-24 13:53:13 +00:00
davidbaumwald 99d0310f77 Coding Standards: Correct alignment in `WP_Theme_JSON_Resolver::get_core_data()`.
Follow-up to [54251].

See #55647.
Built from https://develop.svn.wordpress.org/trunk@54298


git-svn-id: http://core.svn.wordpress.org/trunk@53857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 21:31:10 +00:00
desrosj 5023368035 Build/Test Tools: Test building WordPress to run from `src` first.
Because of the scripts that run when `build:dev` is run, it’s more common for this Grunt task to change version-controlled files than when building WordPress to run from `build`.

This moves the `build:dev` tests before the `build` ones in order to detect changes earlier in the workflow.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54297


git-svn-id: http://core.svn.wordpress.org/trunk@53856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 20:04:13 +00:00
desrosj e4a97cc8e9 Build/Test Tools: Update NPM dependencies to their latest versions.
The following dependencies are being updated:

- `copy-webpack-plugin` from `10.2.4` to `11.0.0`.
- `dotenv` from `16.0.1` to `16.0.2`.
- `dotenv-expand` from `8.0.3` to `9.0.0`.
- `sass` from `1.53.0` to `1.55.0`.
- `sinon-test` from `3.1.3` to `3.1.4`.
- `source-map-loader` from `3.0.1` to `4.0.0`.
- `terser-webpack-plugin` from `5.3.1` to `5.3.6`.
- `uglify-js` from `3.16.1` to `3.17.1`.
- `uuid` from `8.3.2` to `9.0.0`.
- `webpack` from `5.72.0` to `5.74.0`.

This also contains changes after running `npm audit fix`.

Fixes #56641.
Built from https://develop.svn.wordpress.org/trunk@54296


git-svn-id: http://core.svn.wordpress.org/trunk@53855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 19:55:30 +00:00
desrosj 1e41885e42 Build/Test Tools: Update NPM dependencies in default themes, part 2.
Follow up to [54294].

See #56641.
Built from https://develop.svn.wordpress.org/trunk@54295


git-svn-id: http://core.svn.wordpress.org/trunk@53854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 18:53:10 +00:00
desrosj c07a7f38dd Build/Test Tools: Update NPM dependencies in default themes.
This updates NPM dependencies for all default themes that have them.

See #56641.
Built from https://develop.svn.wordpress.org/trunk@54294


git-svn-id: http://core.svn.wordpress.org/trunk@53853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 18:31:09 +00:00
desrosj b85b4cb634 Build/Test Tools: Increase the timeout value for MacOS jobs.
The current `timeout-minutes` value of `20` is a bit too short for MacOS jobs in GitHub Actions, which on occasion take a bit longer.

This bumps that limit to `30` to avoid unnecessarily flagging a job as stuck.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54293


git-svn-id: http://core.svn.wordpress.org/trunk@53852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 17:03:08 +00:00
davidbaumwald 1b463c4601 Docs: Correct `@see` reference to `deprecated_function_run` in the `_deprecated_function` docblock.
In the docblock for `_deprecated_function`, there is a `@see` reference to the `deprecated_function_run` hook run inside `_deprecated_function`.  However, the `@see` reference includes the word "hook" inside the quotes which is generating a bad link at https://developer.wordpress.org/reference/functions/_deprecated_function/.

This change simply moves the word "hook" outside the `@see` reference to correct the link parsing on https://developer.wordpress.org.

Props Camwynsp, kebbet, SergeyBiryukov, hilayt24.
Fixes #56625.
Built from https://develop.svn.wordpress.org/trunk@54292


git-svn-id: http://core.svn.wordpress.org/trunk@53851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 16:20:09 +00:00
Sergey Biryukov 8cb55f5451 Block Editor: Remove repetitive calls to `file_get_contents()` in block editor settings.
The `get_default_block_editor_settings()` function used to repeatedly get the `default-editor-styles.css` file contents without any implementation to avoid this.

This commit utilizes a static variable to remove repetitive calls made during the same request. In tests ran on the front page of a site using Xdebug & Webgrind, the total `file_get_contents()` invocation count goes down from 181 to 93, and total self cost (the time that the function is responsible for) goes down from 160 ms to 93 ms.

Follow-up to [52042].

Props aristath, mukesh27.
Fixes #56637.
Built from https://develop.svn.wordpress.org/trunk@54291


git-svn-id: http://core.svn.wordpress.org/trunk@53850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 14:00:09 +00:00
Sergey Biryukov 4d6518c2d5 Blocks: Remove duplicate use of `realpath()` in `register_block_style_handle()`.
The `register_block_style_handle()` function called `realpath()` when retrieving the normalized style path, and then a few lines below that, recalculated the exact same value, running `realpath()` again.

This commit removes duplicate calculations, reducing the number of `realpath()` calls in the function by half. In tests ran using Xdebug & Webgrind, the total `realpath()` invocation count goes down from 639 to 461, and total self cost (the time that the function is responsible for) goes down from 146 ms to 89 ms.

Follow-up to [48141], [52291], [53091], [54155].

Props aristath.
Fixes #56636.
Built from https://develop.svn.wordpress.org/trunk@54290


git-svn-id: http://core.svn.wordpress.org/trunk@53849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 13:26:09 +00:00
gziolo d963f95253 Build: Improve how combined assets are generated
Allows to revert changes applied in [54277] - temporary workaround for the failing Test NPM CI check on Windows.

Improvements included:
- generate combined asset files for both production and development
- store in the repository only the production version of the combined assets for packages, we use everything else only in development
- to make unit tests work, ensure that they ignore react fast refresh and use the production version of combined assets that are present in the source code

Props bernhard-reiter, jsnajdr, clorith, wildworks.
Fixes #56615.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 08:27:12 +00:00
jorgefilipecosta d8525e93c0 REST API: Fix check for has_archive inclusion.
Props dlh, audrasjb, mukesh27.
Fixes #56618.
Built from https://develop.svn.wordpress.org/trunk@54288


git-svn-id: http://core.svn.wordpress.org/trunk@53847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-22 11:33:13 +00:00
Sergey Biryukov 574cedca42 Docs: Use typed array notation for the `$locales` parameter in plugin update filters.
The value comes from `get_available_languages()`, which returns an array of strings.

This affects:
* `plugins_update_check_locales` filter.
* `update_plugins_{$hostname}` filter.

Follow-up to [36630], [46660], [50921], [53933], [54284].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@54287


git-svn-id: http://core.svn.wordpress.org/trunk@53846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-22 11:13:14 +00:00
audrasjb a9e5a09bcc Docs: Fix `prev_text` and `next_text` parameters type in `paginate_links()`.
Props gabri3lmarques, maximemeganck.
Fixes #56622.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-22 09:26:15 +00:00
John Blackbourn f6fc33d81b Docs: Remove a change that needs to instead be applied in the Gutenberg repo.
See https://github.com/WordPress/gutenberg/pull/44342

See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 20:57:12 +00:00
John Blackbourn f7dc68f99a Docs: Updates and corrections to various inline docs added in 6.1.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 20:24:12 +00:00
desrosj 9bc97dca8c Network and Sites: Move `global_terms_enabled()` to its proper final resting place.
When initially deprecated in [54240], `global_terms_enabled()` was incorrectly moved to the `wp-includes/ms-deprecated.php` file. This file is only loaded for multisite installs.

The function previously lived in `wp-includes/functions.php`, which is loaded for all sites. The proper deprecated file is `wp-includes/deprecated.php`.

Props vikasprogrammer, davidbaumwald, courane01, desrosj.
Fixes #21734.
Built from https://develop.svn.wordpress.org/trunk@54283


git-svn-id: http://core.svn.wordpress.org/trunk@53842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 19:48:13 +00:00
davidbaumwald 685acca99c Post WordPress 6.1 Beta 1 version bump.
Built from https://develop.svn.wordpress.org/trunk@54282


git-svn-id: http://core.svn.wordpress.org/trunk@53841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 17:03:09 +00:00
davidbaumwald 4f7cfb7b83 WordPress 6.1 Beta 1.
Built from https://develop.svn.wordpress.org/trunk@54281


git-svn-id: http://core.svn.wordpress.org/trunk@53840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 16:27:12 +00:00
jorgefilipecosta 292636ff72 Editor: Make template names and descriptions dynamic.
Backports PHP changes in WordPress/gutenberg#43862 to the core. Adds a mechanism to dynamically compute names and descriptions of the author, page, single, tag, category, and taxonomy templates.

Props mcsf, ntsekouras, antonvlasenko, jameskoster.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54280


git-svn-id: http://core.svn.wordpress.org/trunk@53839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 15:45:12 +00:00
joedolson a8b79b2250 Media: Fix JS TypeError with video playlists and native video.
Verify that the `resized` property exists on a video in the playlist before attempting to read it. Prevent a TypeError from being thrown and breaking the playlist if a video type requires native video support.

Props afercia, here.
Fixes #47513.
Built from https://develop.svn.wordpress.org/trunk@54279


git-svn-id: http://core.svn.wordpress.org/trunk@53838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 15:30:14 +00:00
davidbaumwald 0f97ff203b Shortcodes: Revert default filter callback changes from `apply_shortcodes` to `do_shortcode`.
[54248] reversed the wrapping of `do_shortcode` and `apply_shortcodes` and updated all direct internal calls of `do_shortcode` to `apply_shortcodes` after [47004].  Default filter callbacks that used `do_shortcode` were also updated to use `apply_shortcodes`.  However, this introduced a backward-compatibility break because any attempt to unhook a filter using the previous `do_shortcode` callback would be futile.

This change reverts only the filter callback changes in [54248] to resolve the backward-compatibility break.

Follow-up to [47004] and [54248].

Props ocean90, SergeyBiryukov.
See #55883.
Built from https://develop.svn.wordpress.org/trunk@54278


git-svn-id: http://core.svn.wordpress.org/trunk@53837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 15:06:12 +00:00
desrosj b82e57f204 Build/Test Tools: Temporarily allow the NPM testing workflow to fail.
This changes the Test NPM GitHub Action workflow to temporarily allow the job validating build tools on Windows to fail.

When the `build:dev` Grunt task is run on Windows, the resulting hashes calculated by Webpack are different than other platforms. This seems to be related to how the `remove-accents` dependency is read and processed during the build script.

Since a Windows machine is not used to build WordPress on the build server, this will only affect local development installs for Windows contributors. While this is investigated, this workflow job can be allowed to fail.

Props bernhard-reiter, desrosj, Clorith, gziolo.
See #56615.
Built from https://develop.svn.wordpress.org/trunk@54277


git-svn-id: http://core.svn.wordpress.org/trunk@53836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 14:28:14 +00:00
Sergey Biryukov f092e4b013 Editor: Improve block loading PHP performance.
This commit improves PHP performance for core blocks by reading a single PHP file with block metadata, instead of reading a JSON file per-block and then decoding from JSON to PHP.

Includes:
* Adding a new Grunt task to convert `block.json` files to `block-json.php`.
* Using the new `block-json.php` file in the `register_block_type_from_metadata()` function.

Follow-up to [48141].

Props aristath, gziolo, johnbillion, presstoke, mukesh27, hellofromTonya, petitphp, adamsilverstein, costdev, desrosj, SergeyBiryukov.
Fixes #55005.
Built from https://develop.svn.wordpress.org/trunk@54276


git-svn-id: http://core.svn.wordpress.org/trunk@53835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 13:57:21 +00:00