5672 Commits

Author SHA1 Message Date
bernhard-reiter
db589b327c Tests: Add comment to explain when e2e test for gutenberg is skipped
Follow-up to [58046].

Reviewed by jorbin.
Merges [58141] to the 6.4 branch.

See #60971.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@58154 602fd350-edb4-49c9-b593-d223f7449a82
2024-05-15 07:06:46 +00:00
bernhard-reiter
fe402e06ac Tests: Skip Gutenberg plugin activation test on older WP versions.
The purpose of `tests/e2e/specs/gutenberg-plugin.test.js` is to ensure that running the Gutenberg plugin (stable version) on a WordPress `trunk` install doesn't produce any fatals.

The test was introduced in [54913], i.e. it has been around since WP 6.2. It makes sense to have it present on older branches, as the Gutenberg plugin not only supports `trunk`, but also the current stable version of WordPress (i.e. currently 6.5), and one version below (6.4). However, it is not expected to work on any earlier versions beyond that; in practice, it has produced errors on some of those.

This changeset checks the REST API response from the plugin activation request. If it returns an error with error code `plugin_wp_incompatible`, it skips the test.

Reviewed by jorbin.
Merges [58046] to the 6.4 branch.

Props jorbin, johnbillion, swissspidy.
Fixes #60971.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@58153 602fd350-edb4-49c9-b593-d223f7449a82
2024-05-15 07:05:03 +00:00
Sergey Biryukov
812ad8dc12 Tests: Use an image on WordPress.org CDN in external HTTP tests.
Due to some changes on the WP.com side to compress the requested images on the fly, the exact image size in the response could be different between platforms.

This commit aims to make the affected tests more reliable.

Follow-up to [139/tests], [31258], [34568], [47142], [57903], [57904], [57924].

Merges [57931] to the 6.4 branch.

Props peterwilsoncc, jorbin.
See #60865.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57938 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-07 21:18:24 +00:00
Aaron Jorbin
17643e8645 Tests: Update expectations in wp_remote_head() and wp_remote_get() tests.
It appears that something has changed on the WP.com side to compress the requested images on the fly, which interfered with the previous expectations in these tests.

This commit uses a direct file URL and updates the expected image size to match the currently returned response.

Follow-up to [139/tests], [31258], [47142].

Reviewed by jorbin.
Merges [57903] to the 6.4 branch.

Props dextorlobo, swissspidy, davidbaumwald, SergeyBiryukov.
See #60865.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57930 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 21:10:39 +00:00
Aaron Jorbin
6f021272d3 Upload: Fallback to PclZip to validate ZIP file uploads.
ZipArchive can fail to validate ZIP files correctly and report valid files as invalid. This introduces a fallback to PclZip to check validity of files if ZipArchive fails them.

This introduces the new function wp_zip_file_is_valid() to validate archives.

Follow up to [57388].

Reviewed by jorbin.
Merges [57537] to the 6.4 branch.

Props audunmb, azaozz, britner, cdevroe, colorful-tones, costdev, courane01, endymion00, feastdesignco, halounsbury, jeffpaul, johnbillion, jorbin, jsandtro, karinclimber, kevincoleman, koesper, maartenbelmans, mathewemoore, melcarthus, mujuonly, nerdpressteam, olegfuture, otto42, peterwilsoncc, room34, sayful, schutzsmith, stephencronin, svitlana41319, swissspidy, tnolte, tobiasbg, vikram6, welaunchio.
Fixes #60398.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57929 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 19:28:21 +00:00
Aaron Jorbin
69242ba40f Media: Redirect inactive attachment pages for logged-out users.
Ensure logged out users are redirected to the media file when attachment pages are inactive. This removes the read_post capability check from the canonical redirects as anonymous users lack the permission.

This was previously committed in [57310] before being reverted in [57318]. This update includes a fix to cover instances where revealing a URL could be considered a data leak and greatly expands the unit tests to ensure that this is covered along with many other instances.

Follow-up to [56657], [56658], [56711], [57310], [57318].

Reviewed by joemcgill.
Merges [57357] to 6.4 branch.

Props peterwilsoncc, jorbin, afercia, aristath, chesio, joppuyo, jorbin, lakshmananphp, poena, sergeybiryukov, swissspidy, johnbillion, mukesh27.
Fixes #59866.
See #57913.



git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57358 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-25 19:41:24 +00:00
Aaron Jorbin
6338d63ec7 Embeds: Ensure the deprecated function print_emoji_styles isn't used
Ensure that the proper new function wp_enqueue_emoji_styles is used in embeds.

Follow-up to: [56194].

Reviewed by davidbaumwald.
Merges [57306] to the 6.4 branch.

Props peterwilsoncc, bobbingwide, hellofromTonya.
Fixes #59892. See: #58775.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57347 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-24 19:25:00 +00:00
Sergey Biryukov
d9d0fd6495 Tests: Revert [57182] from the 6.4 branch.
This will be committed to trunk instead.

See #59825.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57183 602fd350-edb4-49c9-b593-d223f7449a82
2023-12-12 12:15:45 +00:00
Aaron Jorbin
1bc6ffd52b Build/Test: Add unit tests for wp_checkdate.
Props pbearne, ironprogrammer.
Fixes #59825.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57182 602fd350-edb4-49c9-b593-d223f7449a82
2023-12-11 19:19:25 +00:00
Aaron Jorbin
f2c05952c0 Themes: Remove memoization from stylesheet and theme directories.
This fixes bugs introduced in [56635] whereby the template or stylesheet path could be memoized incorrectly if get_template_directory() or get_stylesheet_directory() were called before the theme has been fully initialized.

Reviewed by Jorbin.
Merges [57129] to 6.4 branch.

Props partyfrikadelle, coreyw, kdowns, rebasaurus, meta4, flixos90, mukesh27, joemcgill, icaleb.
Fixes #59847.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57156 602fd350-edb4-49c9-b593-d223f7449a82
2023-12-04 19:57:30 +00:00
Tonya Mork
743109013b REST API: Restore site logo and icon in index.
Restores setting the site's logo, icon, and wp-admin's back button image (which defaults to W).

Prior to [56566], the site logo and icon were unconditionally added to the index. [56566] changed this by conditionally adding them if either the `_links` or `_embedded` fields were included. However, these fields are not included when using the Site Logo block, as it uses the `site_logo`, `site_icon`, and `site_icon_url` fields instead.

This changeset restores the functionality by checking specifically for the `site_*` fields when neither of the `_links` or `_embedded` fields are present.

Follow up to [56566].

Reviewed by jorbin.
Merges [57147] to the 6.4 branch.

Props antonvlasenko, hellofromTonya, ironprogrammer, priethor, wildworks.
Fixes #59935.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57154 602fd350-edb4-49c9-b593-d223f7449a82
2023-12-04 19:42:44 +00:00
Tonya Mork
9133c83dea Database: Reinstate wpdb::$use_mysqli property.
Partial revert of [56475] to reinstate the private `wpdb::$use_mysqli` property and set to its default to true. This private property was / is accessible through the magic methods. Though Core's usage of this property was removed by [56475], plugins are using the property. Reinstating it resolves the BC break.

Follow up to [56475].

Reviewed by jorbin.
Merges [57089] to the 6.4 branch.

Props jason_the_adams, joemcgill, johnbillion, johnjamesjacoby, jrf, rajinsharwar, renehermi.
Fixes #59846.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57090 602fd350-edb4-49c9-b593-d223f7449a82
2023-11-08 20:36:13 +00:00
Peter Wilson
de9efe0678 Build/Test Tools: Revert [57058].
Revert group name change in the 6.4 branch as the `functions.php` group was renamed `functions` after the branch was forked.

Props SergeyBiryukov.
See #59647, #58955.



git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57059 602fd350-edb4-49c9-b593-d223f7449a82
2023-11-03 23:22:29 +00:00
Peter Wilson
8466bb901b Build/Test Tools: Fix group for wp_unique_prefixed_id() tests.
Change the group from `functions.php` to `functions` to match other tests.

Reviewed by jorbin.
Merges [57057] to the 6.4 branch.

See #59647, #58955.



git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57058 602fd350-edb4-49c9-b593-d223f7449a82
2023-11-03 22:45:37 +00:00
Tonya Mork
46822ca500 Taxonomy: Set "public" to "false" for user pattern categories.
Changes the `'wp_pattern_category'` taxonomy's `'public'` argument to `false`.

Follow-up to [56642].

Reviewed by azaozz, mikeschroder.
Merges [57044] to the 6.4 branch.

Props vrajadas, glendaviesnz, hellofromTonya, ramonopoly.
Fixes #59569.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57045 602fd350-edb4-49c9-b593-d223f7449a82
2023-11-01 15:03:01 +00:00
Bernie Reiter
65e39deeec Blocks: During traversal, allow post callback to modify block.
Both the `$pre_callback` and `$post_callback` functions that are given as arguments to `traverse_and_serialize_block(s)` receive a reference to the current block as their first argument. However, while any changes that the "pre" callback makes to the block are reflected by the serialized markup, the same wasn't true for the "post" callback: Any changes that it made were only applied ''after'' the block had already been serialized.

This commit changes the behavior such that `$post_callback`'s changes to the current block are also reflected in the serialized markup.

Reviewed by hellofromTonya.
Merges [56970] to the 6.4 branch.

See #59646.
Props gziolo.
Fixes #59669.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57043 602fd350-edb4-49c9-b593-d223f7449a82
2023-11-01 12:44:02 +00:00
Sergey Biryukov
ce100be06a Docs: Update some reusable block references to synced patterns.
In WordPress 6.3, [https://wordpress.org/documentation/article/reusable-blocks/ Reusable Blocks were renamed to Patterns]. A synced pattern will behave in exactly the same way as a reusable block.

This commit updates some references in DocBlocks and inline comments to use the new name.

Follow-up to [56030].

Reviewed by hellofromTonya.
Merges [57032] and [57033] to the 6.4 branch.

Props benjaminknox, oglekler, hellofromTonya, marybaum, nicolefurlan.
Fixes #59388.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57040 602fd350-edb4-49c9-b593-d223f7449a82
2023-11-01 11:18:52 +00:00
Tammie Lister
5107a14729 Update editor related npm packages for 6.4 RC3.
The npm packages needed update for 6.4 RC3.

Patch: https://github.com/WordPress/wordpress-develop/pull/5587
This PR includes the following changes:

- Regression: [https://github.com/WordPress/gutenberg/pull/55553 Patterns: fix bug with authors and contributors not seeing user pattern categories].
- Bugfix: [https://github.com/WordPress/gutenberg/pull/55539 Query Loop:Disallow "enhanced pagination" with core blocks that may contain third-party blocks].
- Regression: [https://github.com/WordPress/gutenberg/pull/55667 File: Fix embedded PDF files in Safari].
- Regression: [https://github.com/WordPress/gutenberg/pull/55669 Ensure Term Description block is registered in core]


Reviewed by helloFromTonya.
Merges [57034] to the 6.4 branch.

Props DAreRodz, luisherranz, poena, afercia, danieldudzic, hellofromtonya, siobhyb, mikachan, get_dave, scruffian, wildworks, glendaviesnz, ramonopoly, aaronrobertshaw.

See #59411.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57035 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-31 17:15:59 +00:00
Sergey Biryukov
24cf3ae784 Editor: Correctly load RTL stylesheets in register_core_block_style_handles().
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.

Follow-up to [56524].

Reviewed by hellofromTonya.
Merges [57028] to the 6.4 branch.

Props mukesh27, maahrokh, hellofromTonya, joemcgill, huzaifaalmesbah, rajinsharwar, devmuhib, swissspidy.
Fixes #59715.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57031 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-31 11:57:35 +00:00
Peter Wilson
f74fb43885 Options, Meta APIs: Fast follow fixes for option cache priming functions.
A collection of fixes for `wp_prime_option_caches()`:

* cache arrays and objects in their serialized form for consistency with `get_option()` and `wp_load_alloptions()`
* prevent repeat database queries for falsey and known non-existent options (notoptions)

Additional tests for `wp_prime_option_caches()` to ensure:

* additional database queries are not made repriming options (known, known-unknown and alloptions)
* cache is primed consistently
* `get_option()` returns a consistent value regardless of how it is primed
* database queries do not contain earlier primed options
* `get_option` does not prime the cache when testing the cache has been successfully primed

Fixes a test for `wp_prime_option_caches_by_group()` to ensure `get_option` does not prime the cache when testing the cache has been successfully primed.

Follow up to [56445],[56990],[57013].

Reviewed by flixos90, hellofromTonya, joemcgill.
Merges [57029] to the 6.4 branch.

Props peterwilsoncc, costdev, flixos90, hellofromTonya, mikeschroder, joemcgill.
Fixes #59738. See #58962.



git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57030 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-30 23:21:03 +00:00
Joe McGill
74d3772816 Upgrade/Install: Skip registering theme block patterns during the upgrade process.
This fixes a bug during the database upgrade process where a theme's `functions.php` file may not be loaded, leading to potential exceptions if the theme's pattern files use symbols (classes, functions, constants, etc.) that are declared only when the `functions.php` file is loaded. To do so, a check for `wp_get_active_and_valid_themes()` is added early to `_register_theme_block_patterns()`, which returns early if no active or valid themes are returned.

Props fabiankaegy, rajinsharwar, pbiron, huzaifaalmesbah, hellofromTonya, peterwilsoncc, joemcgill.
Reviewed by hellofromTonya.
Merges [57021] to the 6.4 branch.
Fixes #59723.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57023 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-27 19:23:24 +00:00
Felix Arntz
c6a7ff026c Themes: Skip wrapping block template for singular content with a main query loop when the template was injected from outside the current theme.
As a follow up to [56507], this fixes a bug that could occur for instance when plugins hijack the block template detection process to inject their own block template with entirely custom logic.

Props afragen, hellofromTonya, costdev, mukesh27, huzaifaalmesbah, flixos90.
Merges [57019] to the 6.4 branch.
Fixes #59736.
See #58154.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57020 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-27 18:34:11 +00:00
Peter Wilson
cd04d7552e Options, Meta APIs: Rename option cache priming functions.
Rename the option cache priming functions to more closely follow the naming convention used by other cache priming functions.

* `wp_load_options()` becomes `wp_prime_option_caches()`
* `wp_load_options_by_group()` becomes `wp_prime_option_caches_by_group()`

The unit test files and classes are renamed accordingly.

Unlike the existing cache priming functions, these functions were introduced with the intention of being public so use the `wp_` prefix rather than the `_` prefix used by the functions initially introduced as private functions but since made public.

Follow up to [56445],[56990].

Props flixos90, peterwilsoncc, joemcgill, SergeyBiryukov, desrosj.
Reviewed by flixos90.
Merges [57013] to the 6.4 branch.
Fixes #58962.



git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57016 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-27 00:00:15 +00:00
Felix Arntz
86c47276e3 Themes: Fix block theme supports being added too early, leading to Customizer live preview bugs in 6.4.
The Customizer live preview broke because of [56635], however the root cause for the bug was a lower-level problem that had been present since WordPress 5.8: The block theme specific functions `_add_default_theme_supports()` and `wp_enable_block_templates()` were being hooked into the `setup_theme` action, which fires too early to initialize theme features. Because of that, theme functionality would be initialized before the current theme setup being completed. In the case of the Customizer, that includes overriding which theme is the current theme entirely, thus leading to an inconsistent experience.

This changeset fixes the bug by moving those two callbacks to the `after_setup_theme` action, which is the appropriate action to initialize theme features.

Props karl94, hellofromTonya, joemcgill, flixos90.
Merges [57009] to the 6.4 branch.
Fixes #59732.
See #18298, #53397, #54597.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57010 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-26 18:45:46 +00:00
Felix Arntz
096faeb519 Options, Meta APIs: Rename prime_options() to wp_load_options().
This clearly separates these functions which are intended to be used by external developers from the existing `_prime_*_caches()` functions which are primarily intended for internal usage. The term "load" is additionally more accessible than "prime".

This changeset renames the above function, as well as the wrapper function `prime_options_by_group()` to `wp_load_options_by_group()`.

Props peterwilsoncc, joemcgill, hellofromTonya, poran766, flixos90.
Merges [56990] to the 6.4 branch.
Fixes #58962.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57004 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-24 14:34:43 +00:00
Tonya Mork
a8287a0337 Editor: Fix render_duotone_support() to be compatible with enhanced pagination.
Some blocks do not have content. For duotone support, blocks without content still need to run through the `render_duotone_support()` to render their duotone CSS.

This fix makes the duotone compatible with the enhanced pagination (introduced in 6.4.0) by making sure that the CSS is always on the page, even when the posts have no featured image. It also prevents the duotone from interfering with other blocks using `wp_unique_id()`.

References:
* [https://github.com/WordPress/gutenberg/pull/55415 Gutenberg PR 55415]

Follow-up to [56226].

Props cbravobernal, luisherranz, hellofromTonya, isabel_brison, jorbin.
Reviewed by costdev.
Merges [56991] and [56996] to the 6.4 branch.
Fixes #59694.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@56997 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-24 11:06:59 +00:00
Bernie Reiter
b49db20578 Blocks: Fix layout support to be compatible with enhanced pagination.
Make layout support compatible with enhanced pagination by ensuring that generated class names are stable across pagination, even when the number of rendered posts is different.

With the previous implementation of enhanced pagination, the CSS corresponding to each block was not detected. Therefore, for enhanced pagination to work correctly, the CSS of the blocks present in the Post Template must be stable on all pages.

The number of posts rendered by the Query block is always the same, except in the last page, where it can be only a fraction. If any of the blocks rendered by the Post Template used the `wp_unique_id` function, the ID (which is incremental) would have been different than in the previous pages and the class names would have varied.

This is remediated by this changeset by replacing the usage of `wp_unique_id` in the layout support (which is used by the Query block) with an implementation that uses IDs that are incremental only for that block. That way, the generated class names are never affected by the number of times `wp_unique_id` runs.

Props luisherranz, andrewserong, isabel_brison, costdev, mukesh27, cbravobernal, hellofromTonya, jorbin.
Merges [56994] to the 6.4 branch.
Fixes #59681.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@56995 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-24 09:02:02 +00:00
Peter Wilson
535d9540b2 Build/Test tools: Introduce partial unit tests for WP_Upgrader.
Props jipmoors, karlijnbk, chaion07, cu121, martin.krcho, costdev, mukesh27, hellofromTonya, SergeyBiryukov, audrasjb, jrf.
Merges [56992] to the 6.4 branch.
Fixes #54245.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@56993 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-24 01:40:12 +00:00
Felix Arntz
edb8d8d091 Multisite: Ensure that switching sites resets the current theme directory globals.
The globals introduced in [56635] to cache the current theme directories in memory were not considering switching sites in a multisite network. This changeset addresses the bug including test coverage.

Props codex-m, jeremyfelt, costdev, joemcgill.
Merges [56974] to the 6.4 branch.
Fixes #59677.
See #18298.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@56986 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-23 16:02:02 +00:00
Joe McGill
82fee68dc6 Themes: Make caches for block patterns clearable.
In [56765], theme block pattern files were cached to a transient as a performance enhancement. However, transients are not easily clearable when caches are flushed on environments not using a persistent cache, which can lead to errors if the theme files are renamed, edited, or moved.

This changes the caching mechanism to use `wp_cache_set()` instead, and caches these values to the global group so they are still persistent on environments using an object cache, and will be cleared by a cache flush.

In addition, the helper `_wp_get_block_patterns` has been moved `WP_Theme::get_block_patterns` for consistency with other block related theme methods and cache helpers for these values, `WP_Theme::get_pattern_cache` and `WP_Theme::set_pattern_cache`, have been made private.

Relevant unit tests updated.

Props afercia, flixos90, mukesh27, joemcgill.
Merges [56978] to the 6.4 branch.
Fixes #59633. See #59591, #59490.


git-svn-id: https://develop.svn.wordpress.org/branches/6.4@56979 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-20 19:33:59 +00:00
Bernie Reiter
dcd6e5c036 Patterns, Templates: Inject theme attr into Template Part blocks.
It was found that Template Part blocks were broken in the Site Editor, showing the `Template part has been deleted or is unavailable` message, due to a missing `theme` attribute.

This bug seems to have been introduced by [56896], whose goal was to only inject that attribute into the markup returned by the templates and patterns REST API endpoints but not on the frontend, in order to improve performance. It has been demonstrated locally that reverting that changeset fixes the bug.

Reverts [56896].
Props mmcalister, swisspidy, thelovelist, hellofromTonya, pbiron, Pauthake015, richtabor, nicolefurlan, huzaifaalmesbah, annezazu, kafleg, aegkr, sunitarai, shresthaaman, andraganescu, onemaggie, gziolo.
Fixes #59629.

git-svn-id: https://develop.svn.wordpress.org/trunk@56960 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-17 15:46:44 +00:00
Peter Wilson
c626e63715 Options, Meta APIs: Prevent saving of invalid timezones.
Prevent the saving of invalid timezone string in to the database on the options pages. If an invalid timezone is submitted it is ignored and the setting remains unchanged.

This prevents a warning or fatal (depending on the PHP version) from being thrown by an invalid timezone setting on the Settings > General page.

Props ankit-k-gupta, costdev, huzaifaalmesbah, mrinal013, nicolefurlan, oglekler.
Fixes #58814.


git-svn-id: https://develop.svn.wordpress.org/trunk@56949 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-16 23:49:10 +00:00
Joe McGill
36019306ff Options, Meta APIs: Delete leftover unit tests.
This is a followup to [56946] to commit the deletion of a leftover PHP Unit file.

See #22192.


git-svn-id: https://develop.svn.wordpress.org/trunk@56947 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-16 20:39:19 +00:00
Joe McGill
ccb9ab4834 Options, Meta APIs: Revert update_option changes.
This reverts changes from [56648], [56681], [56717], [56762], [56788], [56797], and [56814] to restore the behavior for `update_option()` and `update_network_option()` to their prior state as of 6.3.X due to the discovery of various backwards compatibility issues found late in the 6.4 release cycle.

Props mukesh27, costdev, flixos90, spacedmonkey, snicco, jrf, joemcgill.
See #22192, #59360.


git-svn-id: https://develop.svn.wordpress.org/trunk@56946 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-16 20:35:05 +00:00
Felix Arntz
1d006a0f57 General: Remove discouraged @return void annotations.
Such `@return void` annotations must not be used in WordPress core's PHP code, except bundled themes, third-party libraries, and PHP compatibility shims.

Props isabel_brison, swissspidy.
Fixes #59619.


git-svn-id: https://develop.svn.wordpress.org/trunk@56943 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-16 15:15:14 +00:00
Sergey Biryukov
0f81f441dc HTML API: Avoid calling subclass method while internally scanning in Tag Processor.
After modifying tags in the HTML API, the Tag Processor backs up to before the tag being modified and then re-parses its attributes. This saves on the code complexity involved in applying updates, which have already been transformed to “lexical updates” by the time they are applied.

In order to do that, `::get_updated_html()` called `::next_tag()` to reuse its logic. However, as a public method, subclasses may change the behavior of that method, and the HTML Processor does just this. It maintains an HTML stack of open elements and when the Tag Processor calls this method to re-scan a tag and its attributes, it leads to a broken stack.

This commit replaces the call to `::next_tag()` with a more appropriate reapplication of its internal parsing logic to rescan the tag name and its attributes. Given the limited nature of what's occurring in `::get_updated_html()`, this should bring with it certain guarantees that no HTML structure is being changed (that structure will only be changed by subclasses like the HTML Processor).

Follow-up to [56274], [56702].

Props dmsnell, zieladam, nicolefurlan.
Fixes #59607.

git-svn-id: https://develop.svn.wordpress.org/trunk@56941 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-16 14:00:01 +00:00
Colin Stewart
60cd149b6f Posts, Post Types: Don't force trailing slash in get_pagenum_link().
Previously, a trailing slash was appended to the link returned from `get_pagenum_link()`. If the permalink structure didn't contain a trailing slash, this link could fail.

This change removes trailing slashes and only appends one if the site is set for adding trailing slashes.

This adds a new test file for the accompanying tests, `tests/phpunit/tests/link/getPagenumLink.php`, and moves an existing test for `get_pagenum_link()` to the same file.

Props davemad-davenet, darkfate, Nazgul, scribu, nacin, obenland, chriscct7, jesin, matthewppelsheimer, audrasjb, petitphp, mukesh27, oglekler, mai21, webtechpooja, tejwanihemant, nicolefurlan, hellofromTonya, costdev.
Fixes #2877.

git-svn-id: https://develop.svn.wordpress.org/trunk@56939 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-16 00:05:28 +00:00
Sergey Biryukov
0633814df8 Tests: Reset the current user before performing assertions in some comment tests.
This aims to avoid affecting other tests in case of failure.

Follow-up to [54527].

See #58955.

git-svn-id: https://develop.svn.wordpress.org/trunk@56936 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-15 08:07:11 +00:00
Pascal Birchler
9d1c581bf6 Build/Test Tools: Do not round percentages when comparing performance test results.
Props joemcgill.
See #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56934 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 20:03:07 +00:00
Weston Ruter
c2409fe804 Script Loader: Move delayed head script to footer when there is a blocking footer dependent.
This prevents a performance regression when a blocking script is enqueued in the footer which depends on a delayed script in the `head` (with `async` or `defer`). In order to preserve the execution order, a delayed dependency must fall back to blocking when there is a blocking dependent. But since it was originally delayed (and thus executes similarly to a footer script), it does not need to be in the head and can be moved to the footer. This prevents blocking the critical rendering path.

Props adamsilverstein, westonruter, flixos90.
Fixes #59599.
See #12009.


git-svn-id: https://develop.svn.wordpress.org/trunk@56933 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 18:44:12 +00:00
Felix Arntz
8382683459 Themes: Clear existing pattern cache when in theme development mode and prevent PHP warning due to missing file.
Follow up to [56765].

Props spacedmonkey, afercia, jrf, flixos90.
Fixes #59591.
See #59490.


git-svn-id: https://develop.svn.wordpress.org/trunk@56931 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 16:44:09 +00:00
Pascal Birchler
93782b5177 Build/Test Tools: Fix path check when comparing performance test results.
This is a follow-up to r56926, r56927, r56928.

See #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56930 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 12:32:28 +00:00
Pascal Birchler
cadf7128e9 Build/Test Tools: Fix file prefix handling in performance test results.
This is a follow-up to r56926.

See #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56928 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 11:28:16 +00:00
Pascal Birchler
5a838d1bb7 Build/Test Tools: Migrate Puppeteer tests to Playwright.
As per the migration plan shared last year, this migrates all browser-based tests in WordPress core to use Playwright.
This includes end-to-end, performance, and visual regression tests.

Props swissspidy, mamaduka, kevin940726, bartkalisz, desrosj, adamsilverstein.
Fixes #59517.

git-svn-id: https://develop.svn.wordpress.org/trunk@56926 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-13 08:11:41 +00:00
Peter Wilson
ac0bae2359 Query: Cache post parent IDs in posts group.
Move the cache of post parent IDs from the dedicated group `post_parents` to `posts`. This maintains backward compatibility for clearing all post object related data by calling `wp_cache_flush_group( 'posts' )`.

Post parent IDs are now cached with with the prefix `post_parent:` in the `posts` group.

Follow up to [56763].

Props spacedmonkey, joemcgill, peterwilsoncc.
See #59188.


git-svn-id: https://develop.svn.wordpress.org/trunk@56925 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 23:39:05 +00:00
Bernie Reiter
33870e1924 Patterns: Don't inject theme attribute on frontend.
Having the patterns registry inject the `theme` attribute into all Template Part blocks inside every pattern was found to negatively impact performance. It turns out that it's only required for the editor (i.e. in the REST API) but not on the frontend; there, it's instead possible to fall back to the currently active theme.

The latter change was made to the Pattern and Template Part blocks in https://github.com/WordPress/gutenberg/pull/55217, which was sync'ed to Core in [56849]. Consequently, this changeset removes `theme` attribute insertion from the frontend.

Props flixos90, gziolo, dmsnell, hellofromtonya.
Fixes #59583.

git-svn-id: https://develop.svn.wordpress.org/trunk@56896 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 16:39:27 +00:00
Jb Audras
1077af7544 Shortcodes: Restrict ajax handler for media shortcode.
Props tykoted, xknown, peterwilsoncc, antpb, jorbin.





git-svn-id: https://develop.svn.wordpress.org/trunk@56838 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:45:49 +00:00
Jb Audras
26007fbc48 REST API: Limit search_columns for users without list_users.
Props Vortfu, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis.





git-svn-id: https://develop.svn.wordpress.org/trunk@56833 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-12 12:28:57 +00:00
Felix Arntz
bb4ab816b5 Editor: Add further test coverage for wp_render_elements_support().
Props dmsnell, aaronrobertshaw.
Fixes #59578.


git-svn-id: https://develop.svn.wordpress.org/trunk@56828 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-11 15:14:01 +00:00
Jonny Harris
1f51e1f4f6 REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers.
The Template and Template Part REST API controllers have unique characteristics compared to other post type REST API controllers. They do not rely on integer IDs to reference objects; instead, they use a combination of the theme name and slug of the template, like 'twentytwentyfour//home.' Consequently, when the post types template and template part were introduced in [52062], it led to the registration of REST API endpoints for autosaves and revisions with invalid URL structures.

In this commit, we introduce new functionality to enable custom autosave and revisions endpoints to be registered at the post type level. Similar to the 'rest_controller_class' parameter, developers can now define 'revisions_rest_controller' and 'autosave_rest_controller.' This empowers developers to create custom controllers for these functionalities. Additionally, we introduce a 'late_route_registration' parameter, which proves helpful when dealing with custom URL patterns and regex pattern matching issues.
This commit registers new classes for template and template part autosave and revisions controllers, differentiating them from standard controllers in the following ways:
* The response shape now matches that of the template controller.
* Permission checks align with the template controller.
* A custom URL pattern is introduced to support slug-based identification of templates.

Furthermore, we've updated the utility function '_build_block_template_result_from_post' to support passing revision post objects. This enhancement ensures compatibility with the custom revisions controller.

Props spacedmonkey, revgeorge, andraganescu, hellofromTonya, antonvlasenko, kadamwhite, ironprogrammer, costdev, mukesh27, timothyblynjacobs, adamsilverstein. 
Fixes 56922.

git-svn-id: https://develop.svn.wordpress.org/trunk@56819 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-10 14:03:03 +00:00