Commit Graph

20276 Commits

Author SHA1 Message Date
Sergey Biryukov
c11ce53dce Query: Avoid PHP notices when get_queried_object() returns null.
`WP_Query` methods assume that `get_queried_object()` would return a non-null value, which is not always the case.

This commit resolves various warnings in `WP_Query` along the lines of:
{{{
Attempt to read property "post_type" on null in wp-includes/class-wp-query.php on line 4338
}}}

Follow-up to [1728], [3639], [8807], [49119].

Props dd32, yellyc, boonebgorges, darkskipper, Howdy_McGee, swissspidy, nacin, mikeschroder, mikejolley, sterlo, datainterlock, utsavmadaan823, kanlukasz, woji29911, hellofromTonya, zikubd, deksar, bwbama, noplanman, nouarah, SergeyBiryukov.
Fixes #29660.
Built from https://develop.svn.wordpress.org/trunk@54496


git-svn-id: http://core.svn.wordpress.org/trunk@54055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 18:15:13 +00:00
Sergey Biryukov
1f002b93fe External Libraries: Further fix jQuery deprecations in WordPress core.
This replaces calls to the deprecated jQuery `.bind()` method with `.on()` in Plupload's `handlers.js`.

Reference: [https://api.jquery.com/bind/ jQuery API Documentation: .bind()]

Follow-up to [18482], [19266], [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50627], [51947], [52429].

Props eclev91, ipajen, sarahricker.
See #51812.
Built from https://develop.svn.wordpress.org/trunk@54495


git-svn-id: http://core.svn.wordpress.org/trunk@54054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 17:37:12 +00:00
davidbaumwald
48ac09448b Editor: Ensure WP_Query and WP_Term_Query results are referenced properly when creating dynamic template names for use in the site editor.
[54445] updated the new dynamic template name functions used by the site editor in 6.1 to use `WP_Query` and `WP_Term_Query` instances in place of `get_posts` and `get_terms` respectively.  However, the latter functions return an array of results whereas `WP_Query` instances store their found results in a class property.  This change updates the code to reference either `$posts_query->posts` or `$terms_query->terms` where necessary.

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

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


git-svn-id: http://core.svn.wordpress.org/trunk@54053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 17:30:12 +00:00
hellofromTonya
701b803ffe Editor: Fix performance regression in WP_Theme_JSON_Resolver.
A significant performance regression was added late in WP 6.1 beta cycle when some of the existing caching for `theme.json` processing was removed. The rationale for removing the caching was this code was now used before all the blocks are registered (aka get template data, etc.) and resulted in stale cache that created issues (see [https://github.com/WordPress/gutenberg/issues/44434 Gutenberg Issue 44434] and [https://github.com/WordPress/gutenberg/issues/44619 Gutenberg Issue 44619]). The changes were limited to only reads from the file system. However, it introduced a big impact in performance.

This commit adds caching and checks for blocks with different origins. How? It add caching for the calculated data for core, theme, and user based on the blocks that are registered. If the blocks haven't changed since the last time they were calculated for the origin, the cached data is returned. Otherwise, the data is recalculated and cached.

Essentially, this brings back the previous cache, but refreshing it when the blocks change.

It partially adds unit tests for these changes. Additional tests will be added.

References:
* [https://github.com/WordPress/gutenberg/issues/44772 Performance regression in WP 6.1 for theme.json processing]

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

Props aristath, oandregal, bernhard-reiter, spacedmonkey, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54493


git-svn-id: http://core.svn.wordpress.org/trunk@54052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 17:17:13 +00:00
desrosj
9bde65e7ba Bundled Themes: Bump version numbers for 6.1.
In coordination with the release of 6.1, a new version of each bundled theme will also be released. This bumps the version of each theme to the following:

- Twenty Ten: 3.7
- Twenty Eleven: 4.2
- Twenty Twelve: 3.8
- Twenty Thirteen: 3.7
- Twenty Fourteen: 3.5
- Twenty Fifteen: 3.3
- Twenty Sixteen: 2.8
- Twenty Seventeen: 3.1
- Twenty Nineteen: 2.4
- Twenty Twenty: 2.1
- Twenty Twenty-One: 1.7
- Twenty Twenty-Two: 1.3

Additionally, this audits all `$version` parameters for `wp_(enqueue|register)_(script|style)` calls, ensuring accurate last edited or theme version values for proper caching and cache busting.

Props robinwpdeveloper, desrosj, mukesh27.
Fixes #56450.
Built from https://develop.svn.wordpress.org/trunk@54492


git-svn-id: http://core.svn.wordpress.org/trunk@54051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 17:05:13 +00:00
hellofromTonya
87a38efddc Editor: Fix version in WP_Theme_JSON_Resolver::get_block_data().
Introduced during the WP 6.1 alpha cycle, this commit fixes the version number from `1` to `2`.

Follow-up to [54162].

Props oandregal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54491


git-svn-id: http://core.svn.wordpress.org/trunk@54050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 16:40:14 +00:00
davidbaumwald
2d9b8cd286 Editor: Bump @wordpress packages for 6.1 Release Candidate 1.
Package updates for bug and regression fixes:
@wordpress/block-directory: 3.15.7
@wordpress/block-library: 7.14.7
@wordpress/customize-widgets: 3.14.7
@wordpress/edit-post: 6.14.7
@wordpress/edit-site: 4.14.9
@wordpress/edit-widgets: 4.14.7

Follow-up to  [54257], [54335], [54383], [54483], and [54486].

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


git-svn-id: http://core.svn.wordpress.org/trunk@54049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 16:34:34 +00:00
Sergey Biryukov
88ba20042c Comments: Consistently normalize user_ID to user_id in wp_new_comment().
For backward compatibility, the `user_id` parameter of `wp_new_comment()` can be spelled as `user_ID`, and plugins utilizing the `preprocess_comment` filter or the `comment_post` action should be able to receive both variations.

Follow-up to [12267], [12300], [28915], [36038], [53729].

Props peterwilsoncc, SergeyBiryukov.
Fixes #56244.
Built from https://develop.svn.wordpress.org/trunk@54489


git-svn-id: http://core.svn.wordpress.org/trunk@54048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 16:32:13 +00:00
Sergey Biryukov
2fc21e6b79 Comments: Return early from comment_form() if an invalid post ID is passed.
If an invalid post ID is passed to the function, `comments_open()` should return `false`, and no comment form be displayed. This commit restores the previous behavior that was unintentionally changed when standardizing on the `$post` parameter name.

Follow-up to [53715].

Props peterwilsoncc.
Fixes #56243.
Built from https://develop.svn.wordpress.org/trunk@54488


git-svn-id: http://core.svn.wordpress.org/trunk@54047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:45:11 +00:00
davidbaumwald
dd2cc423ef Editor: Remove extra line break in build_template_part_block_instance_variations().
This extra break was causing a QUnit failure check validating version controlled file contents.

Follow-up to [54483].

See #56467.
Built from https://develop.svn.wordpress.org/trunk@54487


git-svn-id: http://core.svn.wordpress.org/trunk@54046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:41:13 +00:00
davidbaumwald
0b33636e64 Editor: Change gutenberg_get_typography_font_size_value() calls to wp_get_typography_font_size_value().
Merged Gutenberg functions should be prefixed with `wp_`.

Follow-up to [54483].

Props spacedmonkey.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54486


git-svn-id: http://core.svn.wordpress.org/trunk@54045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:38:11 +00:00
audrasjb
2ddc837e83 Editor: Reinstate old persistence system configuration for the block editor usage data.
In [54182], the configuration for the old preference persistence system was removed. This system is still used for block usage data (to show the most frequently used blocks in the inserter). Furthermore some plugins may use this persistence system.

This changeset reinstates the previous persistence system used by the "Most used blocks" feature in the block inserter.

Follow-up to [54182].

Props talldanwp.
Fixes #56778.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:30:11 +00:00
Sergey Biryukov
08dd56a8b1 Upgrade/Install: Revert a temporary conditional for testing the Rollbacks feature project.
This will be readded in 6.2-alpha after a 6.1 branch is created.

Follow-up to [53578].

See #56057.
Built from https://develop.svn.wordpress.org/trunk@54484


git-svn-id: http://core.svn.wordpress.org/trunk@54043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:28:13 +00:00
davidbaumwald
23d251e0ab Editor: Update packages for 6.1 Release Candidate 1.
Package updates for bug and regression fixes:
@wordpress/block-directory: 3.15.6
@wordpress/block-editor: 10.0.6
@wordpress/block-library: 7.14.6
@wordpress/components: 21.0.5
@wordpress/customize-widgets: 3.14.6
@wordpress/edit-post: 6.14.6
@wordpress/edit-site: 4.14.8
@wordpress/edit-widgets: 4.14.6
@wordpress/editor: 12.16.6
@wordpress/format-library: 3.15.6
@wordpress/interface: 4.16.5
@wordpress/list-reusable-blocks: 3.15.5
@wordpress/nux: 5.15.5
@wordpress/preferences: 2.9.5
@wordpress/reusable-blocks: 3.15.6
@wordpress/server-side-render: 3.15.5
@wordpress/widgets: 2.15.6

References:
* [https://github.com/WordPress/gutenberg/pull/43181 Gutenberg PR 43181] - Merge inner blocks if wrappers are equal
* [https://github.com/WordPress/gutenberg/pull/44098 Gutenberg PR 44098] - Fix content blocks with nested blocks always appear as top level
* [https://github.com/WordPress/gutenberg/pull/44150 Gutenberg PR 44150] - Refresh selection styles
* [https://github.com/WordPress/gutenberg/pull/44415 Gutenberg PR 44415] - Removes `__unstableMaxPages` attribute from Page List and Nav blocks
* [https://github.com/WordPress/gutenberg/pull/44463 Gutenberg PR 44463] - Follow discussion settings in the comments block edit
* [https://github.com/WordPress/gutenberg/pull/44584 Gutenberg PR 44584] - Avoid querying block templates during installation
* [https://github.com/WordPress/gutenberg/pull/44637 Gutenberg PR 44637] - Resizable editor: Fix height setting bug
* [https://github.com/WordPress/gutenberg/pull/44640 Gutenberg PR 44640] - Only include theme.css if the theme declares support for wp-block-styles
* [https://github.com/WordPress/gutenberg/pull/44650 Gutenberg PR 44650] - Fix empty links being created for the author's name comment
* [https://github.com/WordPress/gutenberg/pull/44652 Gutenberg PR 44652] - Block Editor: Fix block search for non-Latin characters
* [https://github.com/WordPress/gutenberg/pull/44660 Gutenberg PR 44660] - Legacy Group inner block wrapper should work with constrained layout
* [https://github.com/WordPress/gutenberg/pull/44676 Gutenberg PR 44676] - Hide list items from content area of content locked blocks
* [https://github.com/WordPress/gutenberg/pull/44718 Gutenberg PR 44718] - Margin visualizer: Apply negative value to margins with `calc()`
* [https://github.com/WordPress/gutenberg/pull/44721 Gutenberg PR 44721] - Remove anchor support from the navigation block
* [https://github.com/WordPress/gutenberg/pull/44731 Gutenberg PR 44731] - Buttons: Add specificity for the editor

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

Props bernhard-reiter, czapla, annezazu, cbravobernal, ndiego, bjorsch, nendeb55.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54483


git-svn-id: http://core.svn.wordpress.org/trunk@54042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:26:55 +00:00
audrasjb
ac36170175 Networks and Sites: Ensure fileupload_maxk is an int to avoid potential fatal errors.
This changeset fixes a potential fatal error, for example when "Max upload file size" setting is set to an empty value. It also adds unit tests for `upload_size_limit_filter`.

Props mjkhajeh, bhrugesh12, SergeyBiryukov, kebbet, audrasjb, felipeelia.
Fixes #55926.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:07:10 +00:00
Sergey Biryukov
82d2620d50 Code Modernization: Add AllowDynamicProperties attribute to recently introduced classes.
This commit is a follow-up to [54133] for new classes introduced in WordPress 6.1 since the previous commit.

Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

Trac ticket #56034 is open to investigate and handle the third and fourth type of situations, however it has become clear this will need more time and will not be ready in time for WP 6.1.

To reduce “noise” in the meantime, both in the error logs of WP users moving onto PHP 8.2, in the test run logs of WP itself, in test runs of plugins and themes, as well as to prevent duplicate tickets from being opened for the same issue, the `#[AllowDynamicProperties]` attribute has been added to all “parent” classes in WP.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [53922], [54133].

Props jrf.
See #56513, #56034.
Built from https://develop.svn.wordpress.org/trunk@54481


git-svn-id: http://core.svn.wordpress.org/trunk@54040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:00:12 +00:00
desrosj
24d7b3df9e Coding Standards: Remove two unnecessary spaces.
Props kebbet.
See #55647.
Built from https://develop.svn.wordpress.org/trunk@54480


git-svn-id: http://core.svn.wordpress.org/trunk@54039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 14:47:11 +00:00
Sergey Biryukov
d989d0b1f7 Tests: Relocate the tests for recommended PHP, MySQL, and MariaDB versions.
This commit moves the tests for recommended versions of dependencies referenced in `readme.html` to a new location for better context. Also updates test class name for clarity, and `@covers` annotations to `@coversNothing`.

Follow-up to [26166], [33946], [35172], [52418], [52424].

Props ironprogrammer, bbobnis, antonvlasenko, azaozz, chaion07, priyomukul.
Fixes #45867.
Built from https://develop.svn.wordpress.org/trunk@54479


git-svn-id: http://core.svn.wordpress.org/trunk@54038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 14:27:11 +00:00
audrasjb
c3645d036d Menus: Remove .menu-item-has-children on wp_nav_menu last level menu items when $depth arg is used.
This changeset prevents `wp_nav_menu` last level menu items from having the `.menu-item-has-children` class when the `$depth` argument is used. It adds a loop in `wp_nav_menu()` to calculate the depth of each menu item with children to make sure the class is added only when applicable.

Props slobodanmanic, kucrut, iCaspar, mdgl, petitphp, audrasjb, costdev.
Fixes #28620.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 14:04:13 +00:00
Sergey Biryukov
13cca70167 Users: Fetch user by login in retrieve_password() if not found by email.
This ensures that sending a password reset link works as expected if the user's login and email were initially the same, but the email address was subsequently updated and no longer matches the login, which is still set to the old address.

Follow-up to [6643], [18513], [19056], [37474], [50129], [50140].

Props donmhico, pbearne, azouamauriac, boblindner, daxelrod, audrasjb, SergeyBiryukov.
Fixes #53634.
Built from https://develop.svn.wordpress.org/trunk@54477


git-svn-id: http://core.svn.wordpress.org/trunk@54036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 13:45:13 +00:00
audrasjb
c985972791 Posts, Post Types: Ensure all entries in the list returned by wp_parse_list() are scalar.
This changeset fixes a warning where `strip_tags()` expected its first parameter to be a string rather than an array. It contains the following changes:

- Removal of sanitize_callback to allow the REST API to handle the validation natively, this also causes the proper error to be output for `?slug[0][1]=2` that it's an invalid value.
- Ensure that `wp_parse_list()` only returns a single-dimensioned array, even if passed a multi-dimension array, which fits the functions expected use case and resolves warnings in code that expects the function to return a single-dimensioned array.

Props dd32, TimothyBlynJacobs.
Fixes #55838.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 13:25:11 +00:00
audrasjb
88b54dc6be Twenty Ten: Adjust Pullquote Block paragraph font size.
This changeset adjusts the size of paragraphs located inside the Pullquote block to account for changes introduced in [82509b6439 (diff-b45331d9b1b9f01d24ffd110e357ce5722772b0a14303ba72ca216c613fc8076) Gutenberg PR 43195]. This ensures the size of the paragraph is set to 1.5em in the editor.

Props sabernhardt.
Fixes #56730.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 12:42:17 +00:00
audrasjb
907986ff68 Formatting: Strip object replacement characters from slugs.
This changeset prevents object replacement characters – UTF-8 `%ef%bf%bc`, used as a placeholder in text for an otherwise unspecified object – from being added to slugs.

Props cantuaria, costdev, audrasjb, SergeyBiryukov, archon810, maciejmackowiak, BaneD, markparnell, ironprogrammer, dmsnell, nikkigagency, webprom.
Fixes #55117.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 10:28:16 +00:00
audrasjb
85975c0104 I18N: Revert [54469].
This changeset reverts [54469] as there is currently no support for parsing JS i18n functions in PHP files which means the strings won't be translatable.

Props ocean90.
Unprops audrasjb.
See #37287.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 10:05:16 +00:00
audrasjb
1d58ed2b6c Build/Test Tools: Add unit test for non-existing block-styles registration.
Follow-up to [54155].

Props aristath, mukesh27.
Fixes #56664.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 10:00:13 +00:00
John Blackbourn
b0890afdfb Taxonomy: Correct an invalid @param tag.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@54030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 09:56:11 +00:00
John Blackbourn
f9db66d504 Docs: Various improvements to inline docblocks.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@54029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 09:02:14 +00:00
audrasjb
287a3c3120 I18N: Use wp.i18n._n() for plural forms in wp_print_admin_notice_templates().
This changeset adds better support for plural forms in update admin notices generated on the Themes and Plugins screens. This fixes issues when translating into languages that have more than one plural form, or more complicated rules for singular form usage.

Props ideag, SergeyBiryukov, daledupreez, audrasjb.
Fixes #37287.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 08:47:12 +00:00
desrosj
8608cdcee8 XML-RPC: Avoid loopback request in blogger.getUsersBlogs.
The `blogger.getUsersBlogs` endpoint does not currently work on Multisite environments which require HTTPS.

This changes `wp_xmlrpc_server::_multisite_getUsersBlogs()` to call the method directly instead of relying on a new `IXR_Client` request, which only supports HTTP.

Props dd32.
Fixes #56492.
Built from https://develop.svn.wordpress.org/trunk@54468


git-svn-id: http://core.svn.wordpress.org/trunk@54027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 01:46:14 +00:00
desrosj
52b8697b05 Twenty Twenty-Three: Bug fixes and improvements for RC1.
Most notably in this update, Twenty Twenty-Three becomes the second default theme to have the “Accessibility Ready” tag.

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

Follow up to [54235], [54236], [54312], [54372].

Props mikachan, madhudollu, tahmidulkarim, joen, poena, scruffian, beafialho, colorful-tones, audrasjb, critterverse, luminuu, wildworks, hiyascout, desrosj.
Fixes #56383.
Built from https://develop.svn.wordpress.org/trunk@54467


git-svn-id: http://core.svn.wordpress.org/trunk@54026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 00:44:12 +00:00
audrasjb
e46fe0fa32 Twenty Nineteen: Add missing compiled CSS declarations after [54413].
Follow-up to [54413].

Props sabernhardt, whaze.
Fixes #55981.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 23:15:12 +00:00
Peter Wilson
a04ba2a0b4 Embeds: Revert Google Data Studio as trusted provider.
Remove Google Data Studio's status as a trusted oEmbed provider pending upstream implementation of the oEmbed specification.

See #55771.


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


git-svn-id: http://core.svn.wordpress.org/trunk@54024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 23:11:12 +00:00
audrasjb
81e88ecaa5 Query: Prevent PHP notice when get_post_type_object() returns null in is_post_type_archive().
This changeset avoids potential PHP notices caused by `get_post_type_object()` returning `null` when called inside `is_post_type_archive()`.

Props sean212, costdev.
Fixes #56287.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 23:03:14 +00:00
audrasjb
8ad3828d20 Twenty Seventeen: Prevent scaling issues on featured images using Safari on iPadOS.
This changeset ensures `background-attachment` is set to `scroll` for parallax images when the browser is iOS Safari and the screen is at least 48em (768px) wide. Narrower screens have the default `scroll` value regardless of the browser. It prevents from scaling issues on the images featured on the front page using Twenty Seventeen.

Props JarretC, sabernhardt, mrfoxtalbot, dkotter.
Fixes #48195.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 21:56:11 +00:00
audrasjb
d95f088a3e General: Remove instances of _wp_http_referer from GET forms in the admin.
This changeset removes all instances of `_wp_http_referer` variable from the URL when creating a hidden input for `_wp_http_referer`. It prevents the hidden field from having an additional version of `_wp_http_referer` each time the form is submitted.

Props msolution, justinahinon, pbearne, mikeschroder, mukesh27, audrasjb, Clorith, chaion07, robinwpdeveloper, hztyfoon, davidbaumwald, costdev, adamsilverstein.
Fixes #54106.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 18:59:11 +00:00
Sergey Biryukov
f821fa413e Cache API: Introduce wp_cache_supports() function.
WordPress has recently introduced a variety of caching API improvements:

* `wp_cache_add_multiple()`
* `wp_cache_set_multiple()`
* `wp_cache_get_multiple()`
* `wp_cache_delete_multiple()`
* `wp_cache_flush_runtime()`
* `wp_cache_flush_group()`

Although WordPress core provides a compatibility layer if these functions are missing from third-party object cache implementations, there should be a method of checking whether the cache backend supports a particular feature.

This commit aims to improve developer experience by allowing third-party object cache plugins to declare a `wp_cache_supports()` function and correctly list their supported features:

* `add_multiple`
* `set_multiple`
* `get_multiple`
* `delete_multiple`
* `flush_runtime`
* `flush_group`

Note: The `wp_cache_supports()` function replaces and supersedes the `wp_cache_supports_group_flush()` function added earlier.

Follow-up to [47938], [47944], [52700], [52703], [52706], [52708], [53763], [53767], [54423].

Props johnjamesjacoby, tillkruess, spacedmonkey, SergeyBiryukov.
Fixes #56605.
Built from https://develop.svn.wordpress.org/trunk@54448


git-svn-id: http://core.svn.wordpress.org/trunk@54007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 18:22:11 +00:00
Sergey Biryukov
e7da835a36 Login and Registration: Rename is_login_screen() function to is_login().
As the function can be used in a variety of contexts, the `_screen` suffix may not always be appropriate.

This commit aims to reduce confusion by renaming the newly added `is_login_screen()` function to `is_login()`, which better aligns with `is_admin()` and the related `is_*_admin()` function family.

While it does not save a lot of lines of code, this function aims to save developers some time that would otherwise be spent investigating the most reliable way to determine whether the current request is for the login screen.

Implementation details:
* By checking `wp_login_url()`, the function accounts for custom login locations set via the `login_url` filter.
* By checking `$_SERVER['SCRIPT_NAME']` directly, instead of `did_action( 'login_form_login' )` or `$pagenow` global, the function can work as early as possible, for example in a must-use plugin.

Follow-up to [53884].

Props azaozz.
Fixes #19898. See #56400.
Built from https://develop.svn.wordpress.org/trunk@54447


git-svn-id: http://core.svn.wordpress.org/trunk@54006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 17:59:12 +00:00
Sergey Biryukov
d161399285 Tests: Use assertSame() in some WP_Theme_JSON tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Previously committed in [54402], these instances appear to be accidentally reverted to `assertEquals()` in [54443].

Follow-up to [52275], [54162], [54402], [54443].

See #55654.
Built from https://develop.svn.wordpress.org/trunk@54446


git-svn-id: http://core.svn.wordpress.org/trunk@54005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 15:59:11 +00:00
davidbaumwald
711c24d3a7 Editor: Dynamic site editor template names performance improvements.
This change updates `get_(posts|terms)()` to direct `WP_Query` calls and adds additional parameters to each query to improve performance.

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

Props spacedmonkey, peterwilsoncc.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54445


git-svn-id: http://core.svn.wordpress.org/trunk@54004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 15:17:13 +00:00
audrasjb
411e2b8580 Build/Test Tools: Add missing newline character on unit tests files after [54443].
Follow-up to [54443].

See #56611.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 15:03:13 +00:00
audrasjb
50b0731750 Build/Test Tools: Expand unit tests for theme.json.
This changeset adds unit test coverage for the following features:

- Gradients
- `filter` (Duotones)
- `blockGap`
- `shadow`
- `useRootPaddingAwareAlignments`
- `appearanceTools`

Props gunterer, johnregan3, audrasjb, mukesh27.
Fixes #56611.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 14:54:11 +00:00
audrasjb
c5f189c4a1 Upgrade/Install: Provide dirpath in error messages when _unzip_file_pclzip() cannot create directories.
This changeset ensures the directory path is provided in error messages when `_unzip_file_pclzip()` is unable to create a directory. This removes `substr()` which was returning an empty string in some use cases.

Props gunterer, SergeyBiryukov, n8finch, peterwilsoncc, audrasjb, rsiddharth, costdev , desrosj, mukesh27.
Fixes #54477.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 12:48:14 +00:00
audrasjb
f4521ee2a1 Docs: Improve wp_get_object_terms() return type.
Props dd32, audrasjb, desrosj, mukesh27.
Fixes #56327.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 12:30:16 +00:00
audrasjb
1795435a9f Users: Fix Users list bottom filters margins on small screens.
This changeset fixes bottom filters margins of the Users list screen on small screens.

Props sumitsingh, sabernhardt, shreyasikhar26, audrasjb.
Fixes #54813.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-09 23:02:31 +00:00
Sergey Biryukov
7b8972ba63 Tests: Minimize file copying in WP_REST_Attachments_Controller tests.
The tests use two images that were deleted on teardown and recreated on setup for every single test. This appears to be unnecessary, as the files can instead only be recreated if they are missing, and deleted after the test run is complete.

This commit reduces ~200 redundant file copying operations to ~5 when running this test class.

Follow-up to [38832], [48291], [54424].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-09 17:47:27 +00:00
Sergey Biryukov
05c3709db3 External Libraries: Upgrade PHPMailer to version 6.6.5.
This is a maintenance release with minor changes:
* Don't try to issue `RSET` if there has been a connection error.
* Reject attempts to add folders as attachments.
* Don't suppress earlier error messages on `close()`.
* Handle `Host === null` better.

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.5

For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.6.4...v6.6.5

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252], [52749], [52811], [53500], [53535], [53917].

Props ayeshrajans, Synchro.
Fixes #56772.
Built from https://develop.svn.wordpress.org/trunk@54427


git-svn-id: http://core.svn.wordpress.org/trunk@53986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-09 17:12:31 +00:00
Sergey Biryukov
2e827f55b4 Coding Standards: Correct alignment in test_import_theme_starter_content().
This fixes an `Equals sign not aligned correctly` WPCS warning.

Follow-up to [54425].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-09 16:39:28 +00:00
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