When making repeated updates to a document, the Tag Processor will end
up copying the entire document once for every update. This can lead to
catastrophic behavior in the worse case.
However, when batch-applying updates it's able to copy chunks of the
document in one thread and only end up copying the entire document once
for the entire batch.
Previously the Tag Processor has been eagerly applying udpates, but in
this patch it defers applying those updates as long as is possible.
Developed in https://github.com/WordPress/wordpress-develop/pull/6120
Discussed in https://core.trac.wordpress.org/ticket/60697
Follow-up to [55706], [56941], [57348].
Reviewed by swissspidy.
Merges [57805] to the to the 6.5 branch.
Props dmsnell, bernhard-reiter, jonsurrell, westonruter.
Fixes#60697.
git-svn-id: https://develop.svn.wordpress.org/branches/6.5@57815 602fd350-edb4-49c9-b593-d223f7449a82
Resetting the `$wp_current_filter` global during test teardown is unnecessary, as it is taken care of by the unit test's base class.
This changeset removes the reset accordingly.
Follow-up [57790].
Reviewed by swissspidy.
Merges [57799] to the to the 6.5 branch.
Props swissspidy, timothyblynjacobs.
See #60671.
git-svn-id: https://develop.svn.wordpress.org/branches/6.5@57803 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds a new `rest_pre_insert_{$this->post_type}` filter in the `WP_REST_Templates_Controller`, where it is applied to the return value of the `prepare_item_for_database` method. (This is consistent with the `WP_REST_Post_Controller`, where that filter has existed before.)
The new filter is then used to inject hooked blocks into the template (or template part) content received via the endpoint, prior to persisting it to the database.
This supersedes the previous mechanism, which was using the `rest_after_insert_{$this->post_type}` ''action'', from which it performed an additional `wp_update_post` call to update the template (part) content with the hooked blocks injected. The new technique eschews that additional call and the resulting extra revision it created, as well as a problem with regard to duplicated escaping and sanitization, which had caused some special characters to be garbled.
Reviewed by swissspidy.
Merges [57790] to the to the 6.5 branch.
Props tomjcafferkey, gziolo, swissspidy, karolmanijak.
Fixes#60671.
git-svn-id: https://develop.svn.wordpress.org/branches/6.5@57802 602fd350-edb4-49c9-b593-d223f7449a82
In some cases, it's possible to seek back into a location found inside
an element which has been closed before the point in the document where
the `seek()` was made. In these cases the breadcrumb stack is lost, and
calling `get_breadcrumbs()` after the seek will return the wrong information.
In this patch, the HTML Processor takes a conservative approach and
moves to the front of the document, then reparses the document until
it reaches the sought-after location. This ensures consistency on
the stack of open elements and active formats, and preserves
breadcrumbs.
Developed in https://github.com/WordPress/wordpress-develop/pull/6185
Discussed in https://core.trac.wordpress.org/ticket/60687
Props jonsurrell.
Follow-up to [60687].
See #58517.
Fixes#60687.
git-svn-id: https://develop.svn.wordpress.org/trunk@57768 602fd350-edb4-49c9-b593-d223f7449a82
Increases clarity about where the function belongs to, bringing it in line with other related functions.
After initially merging this change in [57742] and reverting it in [57743], this reintroduces it now that the Gutenberg packages have been updated accordingly in [57760].
Props swissspidy, gziolo, cbravobernal, youknowriad, ankitmaru, westonruter, luisherranz, darerodz.
Fixes#60575.
git-svn-id: https://develop.svn.wordpress.org/trunk@57762 602fd350-edb4-49c9-b593-d223f7449a82
Add parity between site icon, custom header, and default image crop behaviors. [53027] fixed a bug where alt text and caption were not copied on custom headers, but did not apply that change in any other context.
Deprecate the `create_attachment_object` method in the `Wp_Site_Icon` and `Custom_Image_Header` classes and replace that functionality with the new function `wp_copy_parent_attachment_properties()` to improve consistency.
Props afercia, rcreators, jorbin, joedolson, huzaifaalmesbah, shailu25, swissspidy, mukesh27.
Fixes#60524.
git-svn-id: https://develop.svn.wordpress.org/trunk@57755 602fd350-edb4-49c9-b593-d223f7449a82
Ignores meta keys which are considered protected or not registered to be shown in the REST API. Adds tests.
Props santosguillamot, swissspidy, gziolo, xknown, peterwilsoncc.
Fixes#60651.
git-svn-id: https://develop.svn.wordpress.org/trunk@57754 602fd350-edb4-49c9-b593-d223f7449a82
Since `WP_Filesystem_Direct` is by far the most used filesystem abstraction class, this facilitates future changes with sufficient test coverage.
Props swissspidy, costdev, mukesh27.
Fixes#57774.
git-svn-id: https://develop.svn.wordpress.org/trunk@57753 602fd350-edb4-49c9-b593-d223f7449a82
Unintended leading whitespace at the beginning of a raw MySQL query led to unexpected behavior such as broken pagination. Eliminating said whitespace avoids that.
Adds unit tests to prevent regressions.
Props wpfed, swissspidy, ironprogrammer, tadamarketing, afercia.
Fixes#56841.
git-svn-id: https://develop.svn.wordpress.org/trunk@57750 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that not only the return values match the expected results, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.
Includes correcting the test class name.
Follow-up to [56714].
See #59655.
git-svn-id: https://develop.svn.wordpress.org/trunk@57744 602fd350-edb4-49c9-b593-d223f7449a82
This function can only be renamed after updating Gutenberg npm packages, as some of the core blocks already use this function.
See #60575.
git-svn-id: https://develop.svn.wordpress.org/trunk@57743 602fd350-edb4-49c9-b593-d223f7449a82
Increases clarity about where the function belongs to, bringing it in line with other related functions.
Props swissspidy, gziolo, cbravobernal, youknowriad, ankitmaru, westonruter, luisherranz, darerodz.
Fixes#60575.
git-svn-id: https://develop.svn.wordpress.org/trunk@57742 602fd350-edb4-49c9-b593-d223f7449a82
Includes:
* Moving pre-existing `wp_parse_id_list()` tests to their own file.
* Merging new and pre-existing `wp_parse_slug_list()` tests.
* Using named data provider in `wp_parse_list()` tests.
Follow-up to [25170], [40044], [44546], [57284], [57725].
Props pbearne, mukesh27, SergeyBiryukov.
Fixes#60218. See #60217, #59647.
git-svn-id: https://develop.svn.wordpress.org/trunk@57737 602fd350-edb4-49c9-b593-d223f7449a82
Previously, `WP_Plugin_Dependencies::get_dependency_api_data()` attempted to set an array key using the `slug` property returned in a Plugins API response. However, the Plugins API response is filterable and may not contain a `slug` property.
Earlier in the method, a local `$slug` variable is used as a key for the same array.
For safety and consistency, this replaces array key references to `$information->slug` with `$slug`.
Follow-up to [57545].
Props pbiron, afragen, swissspidy, costdev.
Fixes#60540.
git-svn-id: https://develop.svn.wordpress.org/trunk@57736 602fd350-edb4-49c9-b593-d223f7449a82
r57698 caused a regression for arrays of objects which have magic methods and dynamic properties. A fix is identified.
However, a deeper dive discovered additional scenarios which will require a different fix.
Reverting gives more time for resolving these scenarios and more soak time to discover if there are others.
Props dd32, jamescollins, swissspidy.
See #59774.
git-svn-id: https://develop.svn.wordpress.org/trunk@57732 602fd350-edb4-49c9-b593-d223f7449a82
This documents the new `filePath` property supported by `WP_Block_Patterns_Registry::register` and also updates the property name to camel case formatting to be consistent with other block pattern properties.
Props thekt12, spacedmonkey, joemcgill.
See #59532.
git-svn-id: https://develop.svn.wordpress.org/trunk@57731 602fd350-edb4-49c9-b593-d223f7449a82
This commit updates the theme.json style generation to allow a font family name to be repeated across theme.json origins (default, theme, custom).
Props mmaattiiaass, hellofromtonya, arthur791004, ironprogrammer.
Fixes#60605.
git-svn-id: https://develop.svn.wordpress.org/trunk@57720 602fd350-edb4-49c9-b593-d223f7449a82
The new test checks the functionality of the text direction setting, ensuring it correctly switches between `rtl` and `ltr` options.
Props pbearne, SergeyBiryukov.
Fixes#60219.
git-svn-id: https://develop.svn.wordpress.org/trunk@57718 602fd350-edb4-49c9-b593-d223f7449a82
When resolving theme.json preset variables, add a check to make sure the value is not empty before we run it through strpos() and preg_match_all().
Props ramonopoly, mukesh27, get_dave.
Fixes#60613.
git-svn-id: https://develop.svn.wordpress.org/trunk@57716 602fd350-edb4-49c9-b593-d223f7449a82
Addresses an issue with password reset keys when the email address contains special characters such as apostrophes.
Props emirpprime, rajinsharwar, fnpen, hellofromTonya, oglekler, nicolefurlan.
Fixes#52529.
git-svn-id: https://develop.svn.wordpress.org/trunk@57711 602fd350-edb4-49c9-b593-d223f7449a82
Fix variable alignment in changed tests. Follow-up to [r57708]. Because I edited the wrong local copy when I fixed that.
Props joedolson.
See #34668.
git-svn-id: https://develop.svn.wordpress.org/trunk@57709 602fd350-edb4-49c9-b593-d223f7449a82
Change the admin toolbar to have `role="menu"` and support opening for screen readers. Remove screen reader only log out link and collapse duplicate profile links into one link. This is an imperfect solution to a complex problem in the adminbar, but the lack of screen reader access to submenus is a major accessibility problem, and this fix provides access, even if the mechanism is imperfect.
Screen reader log out added in [21452].
Props abletec, Cheffheid, sabernhardt, alexstine, joedolson, afercia, sparklingrobots, danieltj, swissspidy, netweb, dionysous.
Fixes#34668, #43633.
git-svn-id: https://develop.svn.wordpress.org/trunk@57708 602fd350-edb4-49c9-b593-d223f7449a82
Modify `is_wp_version_compatible()` to return the expected result for major WordPress versions formatted as either `x.x` or `x.x.0` (for example `6.5` and `6.5.0`).
The WordPress project currently documents major version numbers in both formats leading to confusion for developers using the `is_wp_version_compatible()` function. As the PHP function `version_compare()` treats `x.x` and `x.x.0` as different version numbers this leads to unexpected results in the WP function.
This change removes a trailing `.0` from major version numbers to account for the WordPress project using the two formats interchangeably.
Props afragen, azaozz, costdev, joemcgill, jorbin, kkmuffme, sessioncookiemonster, swissspidy, wazeter.
Fixes#59448.
git-svn-id: https://develop.svn.wordpress.org/trunk@57707 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that not only the return values match the expected results, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.
Follow-up to [57283].
See #59655.
git-svn-id: https://develop.svn.wordpress.org/trunk@57706 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that not only the return values match the expected results, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.
Follow-up to [34456], [34460].
Props costdev.
See #59655.
git-svn-id: https://develop.svn.wordpress.org/trunk@57705 602fd350-edb4-49c9-b593-d223f7449a82
This is a followup to [57683], which adds additional unit test coverage to ensure block pattern content is not loaded from files during registration, but instead when those patterns are accessed. This also improves the `set_up` and `tear_down` methods for the `Tests_Blocks_wpBlockPattersRegistry` test class to ensure that any modifications made to registered blocks during the tests are reset after each test.
Props thekt12, joemcgill.
See #59532.
git-svn-id: https://develop.svn.wordpress.org/trunk@57703 602fd350-edb4-49c9-b593-d223f7449a82
Handles when the `$field` (i.e. key or property) is missing in one of the `$input_list` items by checking the key (array) or property (object) exists before using it for assignment.
Resolves the following bugs:
* a PHP warning for undefined key|property.
* `null` being set for that array or object within the returned list.
The changes resolve the issues in both `WP_List_Util::pluck()` (if invoked directly) and `wp_list_pluck()`.
Also includes an additional test for the scenario where the `wp_list_pluck()` `$index_key` is not `null`, the `$field` is missing in one of the `$input_list` items.
Follow-up to [55423], [51663], [42527], [38928].
Props iamarunchaitanyajami, davidbinda, hellofromTonya, helgatheviking.
Fixes#59774.
git-svn-id: https://develop.svn.wordpress.org/trunk@57698 602fd350-edb4-49c9-b593-d223f7449a82
Changes to the `test_readme_mariadb_version()` test were made in an effort to stabilize the connection tests and CI failures. After the changeset, all multisite tests CI jobs connected and passed, but oddly all single site tests CI jobs repeatedly and consistently failed.
Reverting to unblock the CI jobs while continued investigation happens.
See #59647.
git-svn-id: https://develop.svn.wordpress.org/trunk@57689 602fd350-edb4-49c9-b593-d223f7449a82
Add an argument to `wp_mime_type_icon()` to control the file type returned. Following [57638], there are two file formats in the media icons directory. Different systems would pull up different files by default dependent on the order loaded into the cached array, causing intermittent test failures and unpredictable behavior.
Function update allows core usages to always return the `.svg` while maintaining backwards compatibility for any extended usage that expects a `.png`. Follow up to [57638].
Also handles a missed case in media list view.
Props SergeyBiryukov, sabernhardt, joedolson, antpb.
Fixes#31352.
git-svn-id: https://develop.svn.wordpress.org/trunk@57687 602fd350-edb4-49c9-b593-d223f7449a82
Updates `wp_register_font_collection()` and `WP_Font_Collection` so that only font families can be loaded from a file or URL.
All metadata, such as name, description, and list of font categories, needs to be passed directly in PHP so that it can be properly localized.
Props swissspidy, mmaattiiaass, grantmkin, youknowriad.
Fixes#60509.
git-svn-id: https://develop.svn.wordpress.org/trunk@57686 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a bug introduced by [57129] and [56635] in which deprecating the previous `TEMPLATEPATH` and `STYLESHEETPATH` constants in favor of `get_template_directory()` and `get_stylesheet_directory()` functions caused the active theme template path to change when using `switch_to_blog()`.
This introduces a new function, `wp_set_template_globals()`, which is called during the bootstrap process to store the template paths to new globals values `$wp_template_path` and `$wp_stylesheet_path`. This restores behavior to how things worked prior to [56635] but retains the ability for template values to be reset for better testability.
Related #18298, #60025.
Props joemcgill, flixos90, mukesh27, swissspidy, manfcarlo, metropolis_john, jeremyfelt.
Fixes#60290.
git-svn-id: https://develop.svn.wordpress.org/trunk@57685 602fd350-edb4-49c9-b593-d223f7449a82
The `test_readme_mariadb_version()` test method has been experiencing HTTP failures that result in test and CI failures.
This switches to mariadb.org which may result in more stable test runs.
Some additional safety assertions are also included.
Props hellofromTonya, SergeyBiryukov, costdev.
See #59647.
git-svn-id: https://develop.svn.wordpress.org/trunk@57684 602fd350-edb4-49c9-b593-d223f7449a82
This bugfix resolves an issue in `export_wp()` with featured images.
When using Tools > Export and selecting either Posts or Pages (with or without a specific author), the resulting XML file now includes a XML item for each post|page's featured image attachment and its metadata.
Uses same chunking (for performance) and code patterns from existing code in the same file.
Adds a new test class for `export_wp()` with code coverage specific to this bugfix.
Follow-up to [34326], [14444], [6375], [6335].
Props billseymour, nateallen, petitphp, hellofromTonya, duck_, jane, rcain, jghazally, jghazally, smub, batmoo, axwax, creativeslice, dlocc, nacin, wonderboymusic, ganon, SergeyBiryukov, hlashbrooke, chriscct7, fischfood, hifidesign, ankit-k-gupta, 5um17, shailu25, huzaifaalmesbah, mukesh27.
Fixes#17379.
git-svn-id: https://develop.svn.wordpress.org/trunk@57681 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that not only the return values match the expected results, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.
Follow-up to [34085], [35183], [48937], [53782], [53785], [53883], [54402].
Props costdev.
See #59655.
git-svn-id: https://develop.svn.wordpress.org/trunk@57680 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the tests for `WP_Plugin_Dependencies::get_dependency_names()` performed an API request to WordPress.org. If an HTTP failure occurred when connecting to WordPress.org, this could trigger test failures.
This mocks the API response to prevent HTTP failures from triggering test failures.
Follow-up to [57545].
Props swissspidy, peterwilsoncc, costdev.
See #59647.
git-svn-id: https://develop.svn.wordpress.org/trunk@57674 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that not only the return values match the expected results, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.
Follow-up to [49/tests], [198/tests], [34374], [48937], [52269].
Props costdev.
See #59655.
git-svn-id: https://develop.svn.wordpress.org/trunk@57673 602fd350-edb4-49c9-b593-d223f7449a82
Allow returning null from the `hooked_block` and `hooked_block_{$hooked_block_type}` filters to suppress a hooked block from being inserted. This is required to allow extenders conditionally inserting a hooked block based on e.g. the value of an attribute of the anchor block.
Props swissspidy, gziolo, joshuatf, tomjcafferkey.
Fixes 60580.
git-svn-id: https://develop.svn.wordpress.org/trunk@57668 602fd350-edb4-49c9-b593-d223f7449a82