Commit Graph

48417 Commits

Author SHA1 Message Date
desrosj 67c2237b52 Build/Test Tools: Check for zero-byte files in themes.
Because the contents of binary files are not included in patches by default, occasionally empty versions of these files are committed on accident. This is the most commonly happens within default themes because they usually contain image and font files.

This adds a job to the theme related GitHub Action workflow that checks for the presence of zero-byte files so that these instances are caught more easily.

Props costdev, hellofromTonya, luminuu, onemaggie.
Fixes #59527.
Built from https://develop.svn.wordpress.org/trunk@56792


git-svn-id: http://core.svn.wordpress.org/trunk@56304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-06 12:47:25 +00:00
audrasjb 8f66e7884b Twenty Twenty-Three: Add missing font licenses in `readme.txt` file.
Props benimub.
Fixes #59483.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-05 22:46:18 +00:00
Sergey Biryukov 4fd39c6620 HTML API: Rename `WP_HTML_Processor::createFragment()` to follow WPCS.
`WP_HTML_Processor::create_fragment()` is the correct method name as per the WordPress PHP coding standards.

Follow-up to [56274].

Props dmsnell, jrf, hellofromTonya, SergeyBiryukov.
Fixes #59547.
Built from https://develop.svn.wordpress.org/trunk@56790


git-svn-id: http://core.svn.wordpress.org/trunk@56302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-05 22:42:26 +00:00
Felix Arntz bef632d0cc Options, Meta APIs: Fix minor compatibility issue with `update_option()` change.
When calling `update_option()` with value `false` on a non-existent option, prior to [56681] the function would have returned `false` and not stored the value in the database, since the given value was the same as the default.

The aforementioned changeset broke that promise with good intention, however this particular change was a backward compatibility break and therefore is resolved here.

Props mukesh27, costdev.
Fixes #22192.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-05 16:15:27 +00:00
Joe McGill 7291a4dfa0 Themes: Fix core block style paths on Windows.
This is a follow-up to [56528], which normalizes the `BLOCKS_PATH` for Windows prior to making paths relative for caches during the registration process. Prior to this change, incorrect file paths would lead to broken styles for core blocks on Windows.

Props wildworks, pbiron, flixos90, joemcgill.
Fixes #59489. See #59111.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 22:23:27 +00:00
audrasjb a0d3ee6717 Twenty Twenty: Fix style issues within iframed editor.
This changeset:
- Replaces `body` with `html` for the first CSS selector that makes text white against a dark background
- Moves `twentytwenty_block_editor_styles()` from the `enqueue_block_editor_assets` action to `enqueue_block_assets` for WordPress 6.3 and later
- Removes the obsolete `twentytwenty-block-editor-script` from the styles function to avoid an error in the iframe

Props floydwilde, poena, huzaifaalmesbah, greenshady, sabernhardt, audrasjb, pooja1210, shailu25, joemcgill.
Fixes #59086.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 20:56:24 +00:00
desrosj 3751961f50 Build/Test Tools: Don’t send a Slack notice for a workflow’s first failure.
After [53947], all workflows will automatically be restarted once in an attempt to rule out reasons for failures, such as timeouts or network hiccups.

Second attempt at [56404], which was previously reverted in [56407].
See #58867.
Built from https://develop.svn.wordpress.org/trunk@56780


git-svn-id: http://core.svn.wordpress.org/trunk@56292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 19:14:21 +00:00
audrasjb b5bddaa39d Editor: Fix wrong `@since` mention in `remove_insecure_properties()`.
Follow-up to [56502].

See #59108.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 19:03:26 +00:00
hellofromTonya ceffccb71f Twenty Twenty-Four: Fix 6.4 Beta 2 image assets.
Fixes the image assets from [56764] for the images to properly render.

Adds binary file contents (resolves 0 bytes issue) and svn:mime-type property:
* abstract-geometric-art.webp
* building-exterior.webp
* hotel-facade.webp
* museum.webp
* tourist-and-building.webp
* windows.webp

Updates the binary file contents for renamed images:
* angular-roof.webp
* art-gallery.webp
* green-staircase.webp

Follow-up to [56764].

Unprops hellofromTonya.
Props onemaggie, luminuu, colorful-tones, desrosj, mukesh27, nendeb55, nicolefurlan, satishprajapati, shailu25.
Fixes #59526.
See #59524.
Built from https://develop.svn.wordpress.org/trunk@56775


git-svn-id: http://core.svn.wordpress.org/trunk@56287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 17:02:26 +00:00
Sergey Biryukov 4bf7dc11b0 Docs: Use 3-digit, x.x.x style semantic versioning for two `@since` entries.
Follow-up to [41626], [56541].

See #58833.
Built from https://develop.svn.wordpress.org/trunk@56774


git-svn-id: http://core.svn.wordpress.org/trunk@56286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 15:12:28 +00:00
spacedmonkey eb0c7d8864 Docs: Improve documentation for _prime_post_parents_caches().
Add in missing since PHPDoc block for `_prime_post_parents_caches` function added in [56763].

Props mukesh27.
See #59188
Built from https://develop.svn.wordpress.org/trunk@56773


git-svn-id: http://core.svn.wordpress.org/trunk@56285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 12:16:22 +00:00
Sergey Biryukov 43804e0d08 Twenty Fourteen: Correct `@since` entry for an authors list query arguments filter.
Follow-up to [51943].

See #58833.
Built from https://develop.svn.wordpress.org/trunk@56772


git-svn-id: http://core.svn.wordpress.org/trunk@56284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 12:14:24 +00:00
Felix Arntz 3bc56b3de0 Editor: Simplify return shape and logic of `_wp_get_block_patterns()`.
Follow up to [56765].

Props spacedmonkey.
Fixes #59490.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 18:19:23 +00:00
desrosj 22923ffb9d Build/Test Tools: Test Twenty Twenty-Four.
This adds Twenty Twenty-Four to the Default Theme test workflow in GitHub Actions.

Follow up to [56764], [56726], [56721], [56716].
See #59447.
Built from https://develop.svn.wordpress.org/trunk@56770


git-svn-id: http://core.svn.wordpress.org/trunk@56282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 18:12:24 +00:00
hellofromTonya 36df581678 Post WordPress 6.4 Beta 2 version bump.
Built from https://develop.svn.wordpress.org/trunk@56769


git-svn-id: http://core.svn.wordpress.org/trunk@56281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 17:09:23 +00:00
hellofromTonya 9396576d8a WordPress 6.4 Beta 2.
Built from https://develop.svn.wordpress.org/trunk@56768


git-svn-id: http://core.svn.wordpress.org/trunk@56280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 16:32:21 +00:00
Sergey Biryukov f2a85f2b2c Docs: Improve documentation for `get_avatar()` and related functions.
Includes:
* Expanding and synchronizing documentation for the `default` and `rating` arguments.
* Adding `@since` entries for the `loading`, `fetchpriority`, and `decoding` arguments.
* Wrapping long lines as per the documentation standards.
* Fixing a typo in the `identicon` value.
* Minor formatting edits for consistency.

Follow-up to [31107], [45632], [47554], [53480], [56037].

See #58833.
Built from https://develop.svn.wordpress.org/trunk@56767


git-svn-id: http://core.svn.wordpress.org/trunk@56279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 16:15:19 +00:00
hellofromTonya 2a2cbb3b49 Query: Fix a PHPCS issue in `_prime_post_parents_caches()` tests.
Removes an extraneous line break in the `_prime_post_parents_caches()` tests.

Follow-up to [56763].

Unprops spacedmonkey.
Props mukesh27, costdev.
See #59188.
Built from https://develop.svn.wordpress.org/trunk@56766


git-svn-id: http://core.svn.wordpress.org/trunk@56278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:44:22 +00:00
spacedmonkey b0872b005d Editor: Improve performance of _register_theme_block_patterns function.
The `_register_theme_block_patterns` function imposed a significant resource overhead. This issue primarily stems from themes, such as TT4, that register a substantial number of block patterns. These patterns necessitate numerous file operations, including file lookups, file reading into memory, and related processes. To provide an overview, the _register_theme_block_patterns function performed the following file operations:

- is_dir
- is_readable
- file_exists
- glob
- file_get_contents (utilized via get_file_data)

To address these issues, caching using a transient has been added to a new function call `_wp_get_block_patterns`. If theme development mode is disabled and theme exists, the block patterns are saved in a transient cache. This cache is used all requests after that, saving file lookups and reading files into memory. Cache invalidation is done, when themes are switched, deleted or updated. Meaning that block patterns are not stored in the cache incorrectly. 

Props flixos90, joemcgill, peterwilsoncc, costdev, swissspidy, aristath, westonruter, spacedmonkey.
Fixes #59490
Built from https://develop.svn.wordpress.org/trunk@56765


git-svn-id: http://core.svn.wordpress.org/trunk@56277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:18:19 +00:00
hellofromTonya 67161cc1dd Bundled Themes: Update TT4 for 6.4 Beta 2.
Twenty Twenty-Four (TT4) updates for 6.4 Beta 2.

Changes include bugfixes from the theme's development repo since Beta 1 such as: 
* Renamed patterns and images
* Improved image descriptions
* Polished a few of the templates to fit better the design
* Addressed some a11y concerns.
* Changed the required version to 6.4, aligning it with the last few default themes since we are making use of some of the features that will make it to 6.4, such as aspect ratio.

Follow-up to [56726], [56721], [56716].

Props onemaggie, desrosj, mukesh27.
Fixes #59524.
Built from https://develop.svn.wordpress.org/trunk@56764


git-svn-id: http://core.svn.wordpress.org/trunk@56276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:14:22 +00:00
spacedmonkey 5283300aac Query: Improve caching behavior for WP_Query when retrieving id=>parent fields
In [53941], the addition of query caching to `WP_Query` brought about an unintended issue when querying for fields equal to id=>parent. Specifically, on websites with object caching enabled and a substantial number of pages, the second run of this query triggered the `_prime_post_caches` function for id=>parent. This led to the unnecessary priming of post, meta, and term caches, even when only id and parent information were requested.

This commit addresses this issue by introducing a new function, `_prime_post_parents_caches`, which primes a dedicated cache for post parents. This cache is primed during the initial query execution. Subsequently, the `wp_cache_get_multiple` function is employed to retrieve all post parent data in a single object cache request, optimizing performance.

Additionally, this commit extends the coverage of existing unit tests to ensure the reliability of the changes.

Props kevinfodness, joemcgill, peterwilsoncc, LinSoftware, thekt12, spacedmonkey.
Fixes #59188
Built from https://develop.svn.wordpress.org/trunk@56763


git-svn-id: http://core.svn.wordpress.org/trunk@56275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:01:21 +00:00
Felix Arntz ddef9ed1f7 Options, Meta APIs: Implement additional tests covering `update_option()`.
As a follow up to [56681], this changeset adds further tests, primarily focused on ensuring no unnecessary database queries are run.

Props mukesh27, costdev, joemcgill, spacedmonkey.
See #22192.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 14:11:25 +00:00
gziolo c9cbea7627 Tests: Rename and improve the `blocks/context.php` file to follow handbook
Renames `context.php` and `Tests_Blocks_Context` to `renderBlock.php` and `Tests_Blocks_RenderBlock`. See https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#test-classes. 

Simplifies also the tear_down method by using the same convention as in [56759].

Props costdev, ockham.
Follow-up [48224].
See #49927.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 08:54:20 +00:00
gziolo 51ca8e0364 Chore: Remove empty test file that was missed after renaming the file
Follow-up [56759].


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


git-svn-id: http://core.svn.wordpress.org/trunk@56272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 08:36:20 +00:00
gziolo 04ed4159b4 Tests: Cover Block Hooks integration with a custom block theme
Adds a simplified version of Twenty Twenty-Three theme that helps testing Block Hooks integration. The theme contains:

- The required index.html template.
- The optional single.html template used with tests.
- 3 template parts where two of them reference patterns.
- 3 patterns referenced in the templates and the template parts.

New tests automatically register 4 custom blocks with the test theme where each of them hooks into another block using all four target relative positions: `before`, `after`, `firstChild`, `lastChild`.

The tests verify that the block gets hooked into the correct positions when targeting:

- template
- template part
- pattern

Props ockham, costdev.
See #59313, #59383.
Follow-up [56610].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 08:29:23 +00:00
danielbachhuber e249e1aa28 Editor: Add function prefix to avoid conflicts.
Transforms `initialize_theme_preview_hooks` to `wp_initialize_theme_preview_hooks` to avoid conflicts with third-party code.

Follow up to [56529].

Props okat.
See #59000.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 22:42:24 +00:00
Felix Arntz dfe1f0d130 Media: Prevent PHP notice in `get_avatar()`.
Follow up fix to [56690].

Props pereirinha, mukesh27, spacedmonkey.
Fixes #58892.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 20:14:21 +00:00
Tammie Lister ddc07c4598 Update npm packages to latest.
The npm packages needed a further update for beta 2 in preparation for 6.4.

Props @mmaattiiaass , @wildworks , @aaronrobertshaw, @bartkalisz, @mamaduka, @artemiosans, @youknowriad, @czapla, @richtabor, @glendaviesnz, @pbking, @cbravobernal, @madhudollu, @kevin940726, @adamsilverstein, @get_dave, @ntsekouras, @ramonopoly, @jffng, @swissspidy, @carlosgprim, @siobhyb, @mikachan.

See #59411.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 18:58:22 +00:00
Felix Arntz 5496e4b70b Script Loader: Fix missing documentation for the `$path` argument of `wp_enqueue_block_style()`.
See #59466.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 18:48:24 +00:00
Sergey Biryukov ffd72aac28 Coding Standards: Remove redundant ignore annotations, take 5.
The `VariableAnalysis` standard is not used by WP Core.

Follow-up to [50958], [51003], [52049], [52051], [52069], [53072], [54132], [55132], [56363], [56738], [56743], [56751], [56752].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 11:27:24 +00:00
Sergey Biryukov aaba77b577 Coding Standards: Remove redundant ignore annotations, take 4.
This removes ignore annotations related to sniffs which are not used by WP Core (like sniffs in the `WordPress-Extra` ruleset).

Follow-up to [48072], [51003], [55204], [56714].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-01 00:22:27 +00:00
Sergey Biryukov 97cb448897 Coding Standards: Remove redundant ignore annotations, take 3.
This removes ignore annotations about invalid function names for deprecated functions. Those are ignored by design in WPCS since version 2.2.0.

Follow-up to [45580], [47612], [47927].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-30 07:39:26 +00:00
Weston Ruter 583ba4dc6d Script Loader: Remove erroneous `type` attribute from `script` tag wrapper on login screen.
This was causing a `_doing_it_wrong()` notice from `wp_remove_surrounding_empty_script_tags()`. In fact, the `type` attribute was added in [56748] to test this incorrect usage notice. This commit reverts that change.

Follow-up to [56748].
Unprops westonruter.
See #58664.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 22:01:31 +00:00
Weston Ruter 59557e4c6e Customize: Harden and modernize URL manipulation in `WP_Customize_Manager::remove_frameless_preview_messenger_channel()`.
Since IE11 is no longer supported, the `URL` and `URLSearchParams` APIs can now be leveraged for simpler and more robust URL manipulation. This was done similarly in [56383] for `embed.js`.

Props nicolefurlan, dmsnell, westonruter.
Fixes #59480.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 21:39:25 +00:00
Weston Ruter a20cb28d14 Script Loader: Harden removal of script tag wrappers.
* Add `wp_remove_surrounding_empty_script_tags()` to more precisely remove script tag wrappers and warn when doing it wrong.
* Add clarifying comments for XML escaping logic in `wp_get_inline_script_tag()`.
* Leverage `WP_HTML_Tag_Processor` in `test_remove_frameless_preview_messenger_channel`.
* Reuse `assertEqualMarkup` in `test_blocking_dependent_with_delayed_dependency`.
* Normalize whitespace in `parse_markup_fragment` for `assertEqualMarkup`.

Follow-up to [56687].
Props dmsnell, westonruter, flixos90.
See #58664.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 19:47:21 +00:00
spacedmonkey 8aca3fdc68 Comments: Improve WP_Comment_Query count query performance by setting 'order by' to 'none'.
In cases where `WP_Comment_Query` or `get_comments` is employed with the 'count' parameter set to true, specify 'order by' as 'none'. Since these queries serve solely to determine the count of comments matching specific query parameters, the 'order by' clause becomes redundant and places unnecessary strain on the database server, resulting in slower query execution. Given that count queries are executed on every admin request to retrieve comment counts, this change enhances the performance of the wp-admin interface.

Props guss77, davidbaumwald, SergeyBiryukov, westonruter, peterwilsoncc, foliovision, hareesh-pillai, spacedmonkey.
Fixes #58368
Built from https://develop.svn.wordpress.org/trunk@56747


git-svn-id: http://core.svn.wordpress.org/trunk@56259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 17:13:24 +00:00
Aaron Jorbin 3a3f9b80b7 Tests: Reduce usage of assertEquals
Replaces assertSame with assertCount in a number of tests.

Props ayeshrajans, jorbin.
See #58956.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 15:24:22 +00:00
Adam Silverstein 472f1ec59d Revisions: slash meta values for autosave (preview) revisions.
Correct an issue where meta values containing characters like quote `”` could not be previewed on published posts. The function `update_metadata` expects data to be slashed.

Also, add a test to confirm that storing JSON data which requires slashing in autosave meta works as expected, and improve naming for a data provider added in [56714].

Follow up to [56714].

Props mukesh27, spacedmonkey.
Fixes #20564.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 15:07:26 +00:00
spacedmonkey d922a9e96a Editor: Avoid Deferring Loading for Empty Block Script URI
In the context of register_block_script_handle, the get_block_asset_url function may return false when an empty string is provided as the input. This behavior is intended to prevent the generation of invalid URLs. However, when the script loading strategy is set to "defer" while passing false, it triggers a "doing it wrong" message.

This situation becomes problematic, especially for scenarios where the scripts haven't been built yet. In such cases, the realpath call returns an empty string because the file doesn't exist. To address this issue, we now perform a simple check to ensure that the script URI is not empty before applying the "defer" loading strategy. This adjustment prevents unnecessary deferral of loading for scripts with empty URIs.

Follow on from [56683] and [56033].

Props kebbet, mukesh27, swissspidy, westonruter, spacedmonkey.
Fixes #59475
Built from https://develop.svn.wordpress.org/trunk@56744


git-svn-id: http://core.svn.wordpress.org/trunk@56256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 13:15:25 +00:00
Sergey Biryukov 440b8c2aba Coding Standards: Remove redundant ignore annotations, take 2.
This removes ignore annotations which are unnecessary due to the configuration in the `phpcs.xml.dist` ruleset already taking care of this.

Follow-up to [45611], [50146], [50148], [50586], [50822], [56738].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 12:21:24 +00:00
spacedmonkey e74a3bfdb0 Editor: Replace property_exists calls in block related functions with instanceof
Replace calls to `property_exists` with `instanceof WP_Block_Type` in block related functions. This change not only improves type safety but also enhances performance.

Follow on from [56678] and [56677].

Props gziolo, aristath, aaronrobertshaw, spacedmonkey.
Fixes #59453
Built from https://develop.svn.wordpress.org/trunk@56742


git-svn-id: http://core.svn.wordpress.org/trunk@56254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 10:20:30 +00:00
Sergey Biryukov 829bbf3605 Coding Standards: Remove temporary exclusion from the PHPCS ruleset.
Now that the `block-library` package is updated for WP 6.4, this is no longer necessary.

Related PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/53866 #53866 Update WPCS to v3.0, and fix all reported Coding Standards issues]

Follow-up to [56695], [56710].

See #59161.
Built from https://develop.svn.wordpress.org/trunk@56741


git-svn-id: http://core.svn.wordpress.org/trunk@56253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 22:32:22 +00:00
hellofromTonya c42f8ef694 Code Modernization: Fix "passing null to non-nullable" deprecation from next_posts().
The `esc_url()` function expects to a string for `$url` parameter. There is no input validation within that function. The function contains a `ltrim()` which also expects a string. Passing `null` to this parameter results in `Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated` notice on PHP 8.1+.

Tracing the stack back, a `null` is being passed to it within `next_posts()` when `get_next_posts_page_link()` returns `null` (it can return a string or `null`).

On PHP 7.0 to PHP 8.x, an empty string is returned from `esc_url()` when `null` is passed to it. The change in this changeset avoids the deprecation notice by not invoking `esc_url()` when `get_next_posts_page_link()` returns `null` and instead sets the `$output` to an empty string, thus maintain the same behavior as before (minus the deprecation notice).

Adds a test to validate an empty string is returned and the absence of the deprecation (when running on PHP 8.1+).

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

Props codersantosh, nihar007, hellofromTonya, mukesh27, oglekler, rajinsharwar.
Fixes #59154.
Built from https://develop.svn.wordpress.org/trunk@56740


git-svn-id: http://core.svn.wordpress.org/trunk@56252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 21:26:25 +00:00
gziolo 1050b47e06 General: Set the correct script version for `regenerator-runtime`
Follow-up for [56710]. Brings back the version specified in the `package.json` file.

Props ockham.
See #59411.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 08:35:23 +00:00
Sergey Biryukov 11f30a677a Coding Standards: Remove redundant ignore annotations.
This removes ignore annotations which are ignoring an error which would not be thrown for that code.

Includes tidying up the format of the ignore annotation:
* Customary one space between the `//` and the start of the comment.
* There should be no spaces in the comma-separated sniff list.

Follow-up to [45607], [47185], [49200], [53152].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 00:04:24 +00:00
hellofromTonya 565c2179ff Editor: Remove 'wp-edit-site' stylesheet enqueue from iframe.
Removes enqueuing the `'wp-edit-site'` stylesheet from the iframed assets in `_wp_get_iframed_editor_assets()`.

The global `$pagenow` is also removed as it is no longer used within the function.

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

Props ellatrix, jorgefilipecosta, Mamaduka, mukesh27.

Follow-up to [56047], [53160].
Fixes #59456.
Built from https://develop.svn.wordpress.org/trunk@56736


git-svn-id: http://core.svn.wordpress.org/trunk@56248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 17:40:20 +00:00
costdev 872ad9e0b8 Filesystem API: Free the archive in `_unzip_file_ziparchive()`.
There are several early returns in `_unzip_file_ziparchive()` which don't close the archive prior to returning.

As this function is used in installation and upgrade processes which are memory-intensive, this calls `ZipArchive::close()` to free the archive prior to each early return. This excludes the first return which is a result of a failure to open the archive, which is [https://github.com/nih-at/libzip/blob/main/lib/zip_open.c#L62-L73 freed internally] when the failure occurs.

References:
- PHP.net: [https://www.php.net/manual/en/ziparchive.open.php ZipArchive::open()] and [https://www.php.net/manual/en/ziparchive.close.php ZipArchive::close()]
- libzip: [https://libzip.org/documentation/zip_open.html zip_open()] and [https://libzip.org/documentation/zip_close.html zip_close()]

Follow-up to: [13005], [13006], [13015], [13221], [14346] [25779].

Props azaozz, afragen, joemcgill, costdev.
Fixes #59467
Built from https://develop.svn.wordpress.org/trunk@56735


git-svn-id: http://core.svn.wordpress.org/trunk@56247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 16:31:19 +00:00
hellofromTonya 856e2fcfb1 Text Changes: Remove empty space in Erase Personal Data help tab.
Improves the text by removing an empty space at the end of a string within the "Default Data" help tab of the "Erase Personal Data".

Props azharckra, kebbet, krupalpanchal, mukesh27.

Follow-up to [53182].
Fixes #59473.
Built from https://develop.svn.wordpress.org/trunk@56734


git-svn-id: http://core.svn.wordpress.org/trunk@56246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 15:44:24 +00:00
Bernhard Reiter 06be2cac58 Blocks: Add unit test coverage for Patterns registry.
Prior to this changeset, we did not seem to have any unit test coverage for the Patterns registry (`WP_Block_Patterns_Registry`).

With Block Hooks logic recently added ([56649]), it is particularly advisable to add some unit tests to the `get_registered()` and `get_all_registered()` methods to guard hooked block insertion against regressions.

Fixes #59476.
Built from https://develop.svn.wordpress.org/trunk@56733


git-svn-id: http://core.svn.wordpress.org/trunk@56245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 13:10:23 +00:00
Sergey Biryukov b2c997556a Bootstrap/Load: Remove a redundant `continue` statement in `add_magic_quotes()`.
Follow-up to [48205], [48440].

Props Cybr.
See #58831.
Built from https://develop.svn.wordpress.org/trunk@56732


git-svn-id: http://core.svn.wordpress.org/trunk@56244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 09:42:24 +00:00