Commit Graph

29692 Commits

Author SHA1 Message Date
Sergey Biryukov
d36da091c4 Taxonomy: Restore documentation for the taxonomy parameter of wp_list_categories().
The parameter's default value is different from the one in `WP_Term_Query::__construct()`, and should be documented accordingly.

This also clarifies that the `taxonomy` parameter of `wp_list_categories()` only accepts a string, not an array.

Follow-up to [40903], [41767], [45894], [45895].

Props grapplerulrich, mukesh27, TimothyBlynJacobs, SergeyBiryukov.
Fixes #51378. See #47896.
Built from https://develop.svn.wordpress.org/trunk@49060


git-svn-id: http://core.svn.wordpress.org/trunk@48822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-27 08:19:04 +00:00
Sergey Biryukov
5c3a734df0 Docs: Correct description for the taxonomy parameter of wp_dropdown_categories().
Follow-up to [40903], [41767].

Props grapplerulrich, mukesh27, TimothyBlynJacobs.
See #51378.
Built from https://develop.svn.wordpress.org/trunk@49059


git-svn-id: http://core.svn.wordpress.org/trunk@48821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-27 07:49:06 +00:00
Sergey Biryukov
a8b070b56b Docs: Fix typo in a comment in js/media/routers/manage.js.
Props mukesh27, garrett-eclipse.
Fixes #51397.
Built from https://develop.svn.wordpress.org/trunk@49058


git-svn-id: http://core.svn.wordpress.org/trunk@48820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-27 07:38:05 +00:00
Sergey Biryukov
bf2edf9cab External Libraries: Backport a commit from sodium_compat trunk to fix a PHP 8 error.
This addresses an "Undefined constant `MB_OVERLOAD_STRING`" fatal error in the `ParagonIE_Sodium_Core_Util::isMbStringOverride()` method.

In PHP 8, the `MB_OVERLOAD_STRING` constant has been removed, along with the `mbstring` function overloading feature.

Fixes #51399.
Built from https://develop.svn.wordpress.org/trunk@49057


git-svn-id: http://core.svn.wordpress.org/trunk@48819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-27 05:17:05 +00:00
Sergey Biryukov
67752b98e0 Upgrade/Install: Update sodium_compat to v1.13.0.
This includes a few autoloader fixes and improvements.

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

See #51399.
Built from https://develop.svn.wordpress.org/trunk@49056


git-svn-id: http://core.svn.wordpress.org/trunk@48818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-27 04:46:05 +00:00
TimothyBlynJacobs
0db3f859ea Add ircs and irc6 to the list of allowed protocols.
This adds support for the secure and ipv6 variants of the already allowed irc protocol.

Props arealnobrainer, markparnell, ctmartin.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 21:02:04 +00:00
TimothyBlynJacobs
bf397c8d89 REST API: Correct @since version after [49053].
See #51023.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 18:56:04 +00:00
TimothyBlynJacobs
9951662ebb REST API: Support the minProperties and maxProperties JSON Schema keywords.
Props yakimun.
Fixes #51023.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 18:20:07 +00:00
Sergey Biryukov
c9def12900 Tests: Require imagejpeg() function in WP_Widget_Media_Image::render_media() test.
This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test.

This test relies on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025], [49045], [49050].

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49052


git-svn-id: http://core.svn.wordpress.org/trunk@48814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 14:52:07 +00:00
Sergey Biryukov
2e56bb91a8 Tests: Correct assertion in WP_Test_REST_Comments_Controller::check_comment_data().
`author_avatar_urls` should be present in the comment data array keys, not values.

The test only passed accidentally due to `assertContains()` not performing a strict type check.

See #38266, #50913.
Built from https://develop.svn.wordpress.org/trunk@49051


git-svn-id: http://core.svn.wordpress.org/trunk@48813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 03:14:07 +00:00
Sergey Biryukov
cd1f30e28d Tests: Require imagejpeg() function in one more media test.
This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test.

This test relies on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025], [49045].

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49050


git-svn-id: http://core.svn.wordpress.org/trunk@48812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 02:34:06 +00:00
Sergey Biryukov
346794bc57 Upload: Add a check in wp_check_filetype_and_ext() to account for CSV files having the application/csv MIME type.
Previously, the PHP Fileinfo extension used to detect CSV files as `text/plain`.

In PHP 8, this has changed, and CSV files are detected as `application/csv`.

Follow-up to [44438].

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49049


git-svn-id: http://core.svn.wordpress.org/trunk@48811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 01:11:09 +00:00
John Blackbourn
eaf325e386 Upgrade/Install: Introduce the wp_installed_email filter for filtering the contents of the email sent when WordPress is installed, without needing to override the wp_new_blog_notification() pluggable function.
Props Dharm1025, nikolam, johnbillion

Fixes #42133

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


git-svn-id: http://core.svn.wordpress.org/trunk@48810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-25 22:33:08 +00:00
Sergey Biryukov
fe9e57c1c3 Tests: Require imagejpeg() function in some REST API attachments controller tests.
This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test.

These tests rely on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025], [49045].

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49047


git-svn-id: http://core.svn.wordpress.org/trunk@48809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-25 02:23:04 +00:00
Sergey Biryukov
5d31e4368e Tests: Correct the check for image sizes in some REST API attachments controller tests.
If the sizes data could not be retrieved, the controller returns an empty object instead of an array.

This makes sure that the value is in fact an array before proceeding, and outputs a proper message in case of failure, instead of an obscure PHP error further in the test.

Follow-up to [49044].

See #50913, #51393.
Built from https://develop.svn.wordpress.org/trunk@49046


git-svn-id: http://core.svn.wordpress.org/trunk@48808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-25 02:11:03 +00:00
Sergey Biryukov
0485a4ad01 Tests: Require imagejpeg() function in some more media tests.
This outputs a proper message if the requirement is not met, instead of an obscure PHP error further in the test.

These tests rely on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025].

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49045


git-svn-id: http://core.svn.wordpress.org/trunk@48807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-25 01:45:04 +00:00
Sergey Biryukov
312f42f375 Tests: Check if image sizes were successfully retrieved in some REST API attachments controller tests.
This outputs a proper message in case of failure, instead of an obscure PHP error further in the test.

Props TimothyBlynJacobs.
See #50913, #51393.
Built from https://develop.svn.wordpress.org/trunk@49044


git-svn-id: http://core.svn.wordpress.org/trunk@48806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-25 01:31:04 +00:00
Sergey Biryukov
4f8f42747f Code Modernization: Correct the check for parent argument in wp_insert_term() and wp_update_term().
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison

In particular, checking if a non-empty, non-numeric string is greater than zero in PHP 8 evaluates to `true`, not `false`.

For `wp_insert_term()`, this resulted in a "Parent term does not exist" error for a non-numeric string, instead of discarding the value.

By explicitly casting the value to `int`, we make sure to compare both values as numbers, rather than a string and a number.

Follow-up to [29196], [29830], [29867].

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49043


git-svn-id: http://core.svn.wordpress.org/trunk@48805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-25 00:04:04 +00:00
Sergey Biryukov
cfe5b1c9f2 Docs: Add a @since note to wp_privacy_exports_dir and wp_privacy_exports_url filters about exports using relative paths since WordPress 5.5.
When changing exports location via these filters, make sure to migrate the files to the new directory, to avoid breaking any existing exports.

Follow-up to [48127], [48330].

Props garrett-eclipse.
Fixes #51361.
Built from https://develop.svn.wordpress.org/trunk@49042


git-svn-id: http://core.svn.wordpress.org/trunk@48804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-24 05:00:06 +00:00
noisysocks
8fa8aad136 Documentation: Add 'template' arg documentation
Add inline documentation for the 'template' arg accepted by
register_post_type().

Props milana_cap.
See #46261.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-24 03:12:04 +00:00
noisysocks
41b456eca9 Editor: Hide Screen Options tab from block editor
The block editor provides its own interface for managing screen options, so we
can safely hide Screen Options tab found in the top right of the page.

Props aduth.
See #46157.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-24 03:00:08 +00:00
Sergey Biryukov
c10acd850e Build/Test Tools: Use trunk revision 2387243 of the WordPress Importer plugin.
This revision includes a change to only call `libxml_disable_entity_loader()` in PHP < 8, in order for unit tests in the `import` group to pass on PHP 8.

This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading is disabled by default, so this function is no longer needed to protect against XXE attacks.

Follow-up to [46542], [48789].

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


git-svn-id: http://core.svn.wordpress.org/trunk@48801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-23 18:39:07 +00:00
Sergey Biryukov
5c1889f3d8 Docs: Remove obsolete $wpdb global reference from get_site_by_path().
Follow-up to [37628].

Props ravivaddweb, mukesh27.
Fixes #51380.
Built from https://develop.svn.wordpress.org/trunk@49038


git-svn-id: http://core.svn.wordpress.org/trunk@48800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-23 14:11:07 +00:00
Sergey Biryukov
a610519297 Tests: Backport two changes from PHPUnit 9.3:
* Replace the `Match` interface with `ParametersMatch`, to avoid parse errors due to `match` being a reserved keyword in PHP 8.
* Replace `ReflectionParameter::getClass()` usage, which is deprecated in PHP 8.

This allows tests relying on the `getMockForAbstractClass()` and `getMockBuilder()` methods to run again on PHP 8.

When the test suite is updated for compatibility with PHPUnit 9.x, these overrides can be removed.

Follow-up to [48972].

See #50913, #50902.
Built from https://develop.svn.wordpress.org/trunk@49037


git-svn-id: http://core.svn.wordpress.org/trunk@48799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-23 13:54:07 +00:00
Sergey Biryukov
d4a319c453 Users: Check if the user ID passed as selected to wp_dropdown_users() corresponds to an existing user.
This avoids a few PHP notices if the `include_selected` parameter was specified and a non-existing user ID was passed.

Props campusboy1987.
Fixes #51370.
Built from https://develop.svn.wordpress.org/trunk@49036


git-svn-id: http://core.svn.wordpress.org/trunk@48798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-23 00:27:07 +00:00
desrosj
a16faa6989 Privacy: Ensure bulk action related strings end with periods.
Props garrett-eclipse, mukesh27.
Fixes #51371.
Built from https://develop.svn.wordpress.org/trunk@49035


git-svn-id: http://core.svn.wordpress.org/trunk@48797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-22 18:40:04 +00:00
desrosj
6ff2fbb6cd External Libraries: Upgrade PHPMailer to version 6.1.7.
For a full list of changes in this update, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v6.1.6...v6.1.7.

Props ayeshrajans, jrf.
Fixes #51311.
Built from https://develop.svn.wordpress.org/trunk@49034


git-svn-id: http://core.svn.wordpress.org/trunk@48796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-22 18:37:08 +00:00
Sergey Biryukov
b7431cfa83 Tests: Use consistent trailing punctuation in fail() messages.
See #51344.
Built from https://develop.svn.wordpress.org/trunk@49033


git-svn-id: http://core.svn.wordpress.org/trunk@48795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-22 12:34:04 +00:00
Sergey Biryukov
d9346ea967 Tests: Check if image metadata for a particular size was successfully retrieved in some media tests.
This outputs a proper message in case of failure, instead of an obscure PHP error further in the test.

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49032


git-svn-id: http://core.svn.wordpress.org/trunk@48794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-22 12:32:07 +00:00
TimothyBlynJacobs
883ace38f1 REST API: Regenerate test fixtures after [48982].
Props garrett-eclipse.
Fixes #50805.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 22:54:06 +00:00
Sergey Biryukov
5d99107bf3 Tests: Fix typo in some markTestSkipped() messages.
See #51344.
Built from https://develop.svn.wordpress.org/trunk@49030


git-svn-id: http://core.svn.wordpress.org/trunk@48792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 20:20:07 +00:00
John Blackbourn
175c2c5b7c Users: Introduce the invited_user_email filter for filtering the contents of the email sent when an existing user is invited to a site on Multisite.
Props contact-banker, anand.au14, nikolam, johnbillion

Fixes #42132

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


git-svn-id: http://core.svn.wordpress.org/trunk@48791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 17:16:07 +00:00
John Blackbourn
aef504acfd Docs: Correct the indentation for some array type docs.
See #50768

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


git-svn-id: http://core.svn.wordpress.org/trunk@48790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 16:46:06 +00:00
Sergey Biryukov
790983eca4 Tests: Use consistent trailing punctuation in markTestSkipped() messages.
See #51344.
Built from https://develop.svn.wordpress.org/trunk@49027


git-svn-id: http://core.svn.wordpress.org/trunk@48789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 14:07:05 +00:00
Sergey Biryukov
29c0edfbba Privacy: Check if the accumulated data in wp_privacy_process_personal_data_export_page() is not empty.
This avoids an error on PHP 8 caused by passing an empty string to `array_merge()`, instead of an array.

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49026


git-svn-id: http://core.svn.wordpress.org/trunk@48788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 13:51:03 +00:00
Sergey Biryukov
a95e9a91da Tests: Convert a few more function_exists() and extension_loaded() checks to @requires annotations.
This better utilizes the PHPUnit native functionality.

Follow-up to [49024].

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49025


git-svn-id: http://core.svn.wordpress.org/trunk@48787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 13:27:02 +00:00
Sergey Biryukov
1e39e21616 Tests: Convert the checks for imagejpeg() function availability to use the @requires annotation.
This better utilizes the PHPUnit native functionality.

Props ayeshrajans, jrf, johnbillion.
Fixes #50639. See #50640.
Built from https://develop.svn.wordpress.org/trunk@49024


git-svn-id: http://core.svn.wordpress.org/trunk@48786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 11:36:04 +00:00
Sergey Biryukov
6e5ca746e1 General: Give the $is variable in is_wp_error() a more descriptive name.
Follow-up to [49022].

See #40568.
Built from https://develop.svn.wordpress.org/trunk@49023


git-svn-id: http://core.svn.wordpress.org/trunk@48785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 11:13:05 +00:00
John Blackbourn
964d0784be General: Introduce the wp_error_added and wp_error_checked actions.
These actions allow debugging tools to track `WP_Error` instances as they're created and subsequently passed between functions which check for error objects.

Props Shelob9, Mte90, TimothyBlynJacobs, johnbillion

Fixes #40568


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


git-svn-id: http://core.svn.wordpress.org/trunk@48784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 17:44:07 +00:00
John Blackbourn
aba2165aae Media: Standardise the description for image size parameters.
This brings continuity to all the image related functions and filters which accept or pass a size parameter.

Props dilipbheda, johnbillion

Fixes #47364

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


git-svn-id: http://core.svn.wordpress.org/trunk@48783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 16:23:07 +00:00
John Blackbourn
0b2e31a7f8 Docs: Inline documentation improvements for media related functions and hooks.
See #47364, #50768

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


git-svn-id: http://core.svn.wordpress.org/trunk@48782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 15:55:10 +00:00
Sergey Biryukov
2884b7b1b7 Media: Return a WP_Error from WP_Image_Editor_GD::load() if file contents could not be retrieved.
This avoids an error on PHP 8 caused by calling `imagecreatefromstring()` on an empty result.

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49019


git-svn-id: http://core.svn.wordpress.org/trunk@48781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:28:05 +00:00
Sergey Biryukov
8752dbaaba Tests: Correctly unset non-supported image editor engines in some image tests.
Follow-up to [49009], [49014].

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49018


git-svn-id: http://core.svn.wordpress.org/trunk@48780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:15:03 +00:00
John Blackbourn
43b11121de Media: Correct some types for attachment ID parameters passed to functions and filters.
See #47364, #50768 

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


git-svn-id: http://core.svn.wordpress.org/trunk@48779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:05:05 +00:00
John Blackbourn
e22107ce4e Media: Correct some types in docblocks for filters related to thumbnails.
Props dilipbheda

See #47364, #50768

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


git-svn-id: http://core.svn.wordpress.org/trunk@48778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:40:04 +00:00
Sergey Biryukov
e6fd778208 Tests: Use more specific assertions in Tests_Image_Functions::test_load_directory().
This avoids an error on PHP 8 caused by calling `get_resource_type()` on a string.

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49015


git-svn-id: http://core.svn.wordpress.org/trunk@48777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:33:04 +00:00
Sergey Biryukov
a29b071f80 Tests: Optimize some image tests to avoid checking for image editor engines availability twice.
Follow-up to [49009].

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49014


git-svn-id: http://core.svn.wordpress.org/trunk@48776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:27:05 +00:00
John Blackbourn
7d61c45afc I18N: Add a language icon next to the Default Language network option.
Fixes #51359

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


git-svn-id: http://core.svn.wordpress.org/trunk@48775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:18:05 +00:00
John Blackbourn
ecfff6fe80 Media: Correct the image thumbnail logic in media templates.
This ensures the correct data properties are checked before displaying image thumbnails.

Props chetan200891

Fixes #49655

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


git-svn-id: http://core.svn.wordpress.org/trunk@48774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:15:04 +00:00
John Blackbourn
123806ff28 Themes: Remove the ability to delete themes from the single site Appearance screen on Multisite installations.
This brings theme deletion inline with plugin deletion and theme and plugin editing, which can only be performed from within Network Admin.

Props Mista-Flo, williampatton, johnbillion

Fixes #41441

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


git-svn-id: http://core.svn.wordpress.org/trunk@48773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 12:03:05 +00:00
Sergey Biryukov
e8f35359d7 Tests: Consistently require imagejpeg() function in image_make_intermediate_size() tests.
This outputs a proper message if the requirement is not met, instead of an obscure PHP error further in the test.

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49010


git-svn-id: http://core.svn.wordpress.org/trunk@48772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 03:33:05 +00:00
Sergey Biryukov
795e4ebd31 Tests: Skip some image tests if neither GD nor Imagick image editor engines are supported on the system.
The explicit message brings some consistency with other image editor tests, specifically the ones using the `WP_Image_UnitTestCase` class.

Previously, the tests were marked as "risky" in that scenario, due to performing no assertions.

See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49009


git-svn-id: http://core.svn.wordpress.org/trunk@48771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 02:47:05 +00:00
Sergey Biryukov
8791de899a Coding Standards: Fix WPCS issue in [49007].
See #50913.
Built from https://develop.svn.wordpress.org/trunk@49008


git-svn-id: http://core.svn.wordpress.org/trunk@48770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 01:18:04 +00:00
Sergey Biryukov
9e3b5d2f12 Tests: Fix the failures in REST API format keyword validation tests on PHP 8.
The tests ensure that `rest_sanitize_value_from_schema()` and `rest_validate_value_from_schema()` throw an "undefined offset" notice when the required `type` schema keyword is not passed.

In PHP 8, that notice is now a warning, so the tests need to be adjusted accordingly.

Follow-up to [48300], [48993].

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49007


git-svn-id: http://core.svn.wordpress.org/trunk@48769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 00:57:06 +00:00
Sergey Biryukov
4ae2bafafd Tests: Add missing @covers tags for files in phpunit/tests/functions/.
Props pbearne, jrf.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@49006


git-svn-id: http://core.svn.wordpress.org/trunk@48768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 15:54:03 +00:00
Sergey Biryukov
9bb4b76044 Tests: Speed up slashed data tests by reusing some more shared fixtures.
Follow-up to [35249], [49003].

See #51344.
Built from https://develop.svn.wordpress.org/trunk@49005


git-svn-id: http://core.svn.wordpress.org/trunk@48767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 11:12:04 +00:00
Sergey Biryukov
b27ebaa269 Coding Standards: Give the $id variable in slashed data tests a more descriptive name.
See #50767, #51344.
Built from https://develop.svn.wordpress.org/trunk@49004


git-svn-id: http://core.svn.wordpress.org/trunk@48766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 10:55:05 +00:00
Sergey Biryukov
54fe0e0698 Tests: Speed up slashed data tests by reusing shared fixtures.
Follow-up to [35249].

See #51344.
Built from https://develop.svn.wordpress.org/trunk@49003


git-svn-id: http://core.svn.wordpress.org/trunk@48765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 10:36:03 +00:00
Sergey Biryukov
c50c266e51 Tests: Speed up tests for wp_allow_comment() by reusing shared fixtures.
Props frank-klein.
Fixes #51216.
Built from https://develop.svn.wordpress.org/trunk@49002


git-svn-id: http://core.svn.wordpress.org/trunk@48764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 09:27:06 +00:00
Sergey Biryukov
f2a2ffbf2c Tests: Simplify the logic in WP_UnitTestCase_Base::setUpBeforeClass() and ::tearDownAfterClass().
See #51344.
Built from https://develop.svn.wordpress.org/trunk@49001


git-svn-id: http://core.svn.wordpress.org/trunk@48763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 09:13:07 +00:00
Peter Wilson
b1505c2d9c Posts, Post Types: Ensure default terms are added by wp_publish_post().
Transitioning posts from `auto-draft` to `publish` via `wp_publish_post()` could result in published posts without the default category or custom taxonomy default terms.

Props frank-klein, TimothyBlynJacobs, peterwilsoncc.
Fixes #51292.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 01:22:08 +00:00
Sergey Biryukov
88ea2929b7 Tests: Simplify PluralFormsTest::test_exceptions().
Previously, the test had to use an older pattern for catching the generic `Exception` exceptions for compatibility with PHPUnit 3.6 on PHP 5.2.

Now that WordPress supports PHPUnit 5.4 as the minimum version, the `expectException()` method can be used directly.

Follow-up to [41725], [41730].

See #51344.
Built from https://develop.svn.wordpress.org/trunk@48999


git-svn-id: http://core.svn.wordpress.org/trunk@48761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 14:13:03 +00:00
Sergey Biryukov
0e0c620dee Docs: Update the code example in WP_Ajax_UnitTestCase::dieHandler() DocBlock to use expectException().
Follow-up to [48996], [48997].

See #51344.
Built from https://develop.svn.wordpress.org/trunk@48998


git-svn-id: http://core.svn.wordpress.org/trunk@48760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:55:04 +00:00
Sergey Biryukov
b69db72a08 Tests: Switch Ajax tests to use the expectException() method directly, instead of the WP_UnitTestCase_Base::setExpectedException() wrapper.
This brings some consistency with other tests.

Follow-up to [48996].

See #51344.
Built from https://develop.svn.wordpress.org/trunk@48997


git-svn-id: http://core.svn.wordpress.org/trunk@48759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:50:04 +00:00
Sergey Biryukov
e42779f9a0 Tests: Consistently use the expectException() method instead of the older @expectedException annotation.
See https://thephp.cc/news/2016/02/questioning-phpunit-best-practices

The method is available since PHPUnit 5.2, and WordPress currently supports PHPUnit 5.4 as the minimum version.

Follow-up to [48993].

See #51344.
Built from https://develop.svn.wordpress.org/trunk@48996


git-svn-id: http://core.svn.wordpress.org/trunk@48758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:24:07 +00:00
Sergey Biryukov
68d3c5ca56 Docs: Add a @since note about adjacent_posts_rel_link_wp_head() no longer being used in core.
Follow-up to [48966].

Props jnylen0.
See #39111.
Built from https://develop.svn.wordpress.org/trunk@48995


git-svn-id: http://core.svn.wordpress.org/trunk@48757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 11:06:04 +00:00
Sergey Biryukov
0cdab6e91d Docs: Add a @since note for the recovery_mode_email filter about the $email argument now including the attachments key.
Follow-up to [48964].

See #51276.
Built from https://develop.svn.wordpress.org/trunk@48994


git-svn-id: http://core.svn.wordpress.org/trunk@48756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 11:03:02 +00:00
Sergey Biryukov
6f4de5f31a Tests: Fix the failure in test_get_weekday_undefined_index() on PHP 8.
The test ensures that `WP_Locale::get_weekday()` throws an "undefined offset" notice when called with an incorrect `$weekday_number` parameter.

In PHP 8, that notice is now a warning, so the test needs to be adjusted accordingly.

See #50913.
Built from https://develop.svn.wordpress.org/trunk@48993


git-svn-id: http://core.svn.wordpress.org/trunk@48755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:58:03 +00:00
Sergey Biryukov
ddefc9ee9a Twenty Twenty: Update the URL for PHP date formats table in translator comments.
Follow-up to [48991].

Props hareesh-pillai, mukesh27, iandunn.
Fixes #51335. See #51332.
Built from https://develop.svn.wordpress.org/trunk@48992


git-svn-id: http://core.svn.wordpress.org/trunk@48754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:44:04 +00:00
Sergey Biryukov
d5b8d282e8 Docs: Update the URL for PHP date formats table in translator comments.
Props hareesh-pillai, iandunn.
Fixes #51332.
Built from https://develop.svn.wordpress.org/trunk@48991


git-svn-id: http://core.svn.wordpress.org/trunk@48753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:37:08 +00:00
Sergey Biryukov
e1a05a42d3 Comments: Assign the array of comment data returned from the comments_pre_query filter to the comments property of the current WP_Comment_Query instance.
This avoids the performance overhead of calling `WP_Comment_Query::get_comments()` twice: first when creating the object instance, then to retrieve the filtered results.

This also makes the filter a bit more consistent with other similar filters, e.g. `posts_pre_query`, `terms_pre_query`, or `users_pre_query`.

Follow-up to [46086].

Props dinhtungdu, imath, spacedmonkey, adamsilverstein, SergeyBiryukov.
Fixes #50521.
Built from https://develop.svn.wordpress.org/trunk@48990


git-svn-id: http://core.svn.wordpress.org/trunk@48752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 19:55:08 +00:00
antpb
541796de46 Media: Allow contextually generated images to show in Media Library grid view.
In grid view, contextually generated or cropped media is filtered out causing page numbering to be offset and incorrect. This also impacted any media utilizing `media-models.js`.
Props webmandesign, audrasjb, afercia, pbiron, mista-flo.
Fixes #46127, #50410, #47215.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 14:42:04 +00:00
Sergey Biryukov
359119a31e Tests: Move the data_wp_site_query_meta_query() data provider next to the test it's used in.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@48988


git-svn-id: http://core.svn.wordpress.org/trunk@48750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:30:02 +00:00
Sergey Biryukov
226dc9fc2c Docs: Correct comments in comments_pre_query, networks_pre_query, and sites_pre_query tests.
Follow-up to [44983], [46086].

See #50768.
Built from https://develop.svn.wordpress.org/trunk@48987


git-svn-id: http://core.svn.wordpress.org/trunk@48749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:20:04 +00:00
Sergey Biryukov
e01409866e Docs: Reformat comments_pre_query, networks_pre_query, sites_pre_query DocBlocks for better readability.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48986


git-svn-id: http://core.svn.wordpress.org/trunk@48748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:10:03 +00:00
Sergey Biryukov
b66ff2f68d Docs: Fix typo in *_pre_query filter DocBlocks.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48985


git-svn-id: http://core.svn.wordpress.org/trunk@48747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:45:03 +00:00
Sergey Biryukov
06e53b90a1 Docs: Correct the parameter type for networks_pre_query filter.
The filter should return the network count as an integer if `$this->query_vars['count']` is set.

Follow-up to [46100].

See #50768, #47599.
Built from https://develop.svn.wordpress.org/trunk@48984


git-svn-id: http://core.svn.wordpress.org/trunk@48746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:37:05 +00:00
Sergey Biryukov
ac00862f44 Formatting: Make sure links_add_target() adds the target attribute to the correct tag.
Previously, the attribute could unintentionally be added to a tag that starts with the same characters, e.g. `<aside>` instead of `<a>`.

Props antonlukin.
Fixes #51313.
Built from https://develop.svn.wordpress.org/trunk@48983


git-svn-id: http://core.svn.wordpress.org/trunk@48745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:14:07 +00:00
Helen Hou-Sandí
75262781d9 i18n: Ensure block type strings in the REST API end with a full stop.
Props ramiy, justinahinon.
Fixes #50805.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-16 19:23:07 +00:00
Sergey Biryukov
eef2e5c85c Code Modernization: Return an empty string from wpdb::prepare() if there are not enough arguments to match the placeholders.
This avoids a fatal error on PHP 8 caused by passing mismatched arguments to `vsprintf()`, and maintains the current behaviour.

Follow-up to [48979], [48980].

See #50913, #50639.
Built from https://develop.svn.wordpress.org/trunk@48981


git-svn-id: http://core.svn.wordpress.org/trunk@48743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-16 02:29:06 +00:00
Sergey Biryukov
9734ed5673 Code Modernization: Return an empty string from wpdb::_real_escape() if a non-scalar value is passed.
This avoids a fatal error on PHP 8 caused by passing a non-string value to ` mysqli_real_escape_string()`, and maintains the current behaviour.

See #50913, #50639.
Built from https://develop.svn.wordpress.org/trunk@48980


git-svn-id: http://core.svn.wordpress.org/trunk@48742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-16 01:48:10 +00:00
Sergey Biryukov
b37e0cec1b Tests: Revert [48973].
These tests ensure that a `_doing_it_wrong()` notice is thrown when `wpdb::prepare()` is called incorrectly, but also that the function will still handle the provided input as correctly as possible.

Disabling these tests on PHP 8 hides a problem, i.e. the function will no longer throw a notice and handle things correctly, it will now cause a white screen of death due to a fatal error.

That is a backward compatibility break, and `wpdb::prepare()` should be updated instead to maintain the original behaviour on PHP 8.

Props jrf, ayeshrajans.
See #50913, #50639.
Built from https://develop.svn.wordpress.org/trunk@48979


git-svn-id: http://core.svn.wordpress.org/trunk@48741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-16 01:35:09 +00:00
Sergey Biryukov
3838ecccdd Build/Test Tools: Restore the QUnit global in JSHint config for QUnit.
Follow-up to [47512], [48977].

See #51312, #37117.
Built from https://develop.svn.wordpress.org/trunk@48978


git-svn-id: http://core.svn.wordpress.org/trunk@48740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-15 10:09:07 +00:00
Sergey Biryukov
79ab76f5d8 Build/Test Tools: Remove unused legacy globals from JSHint config for QUnit.
Follow-up to [47512].

Props TimoTijhof.
Fixes #51312. See #37117.
Built from https://develop.svn.wordpress.org/trunk@48977


git-svn-id: http://core.svn.wordpress.org/trunk@48739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-15 10:04:05 +00:00
Sergey Biryukov
042bdf66fd Docs: Document the usage of $wpdb global in wp_delete_attachment_files().
Props jontyravi.
Fixes #51309.
Built from https://develop.svn.wordpress.org/trunk@48976


git-svn-id: http://core.svn.wordpress.org/trunk@48738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-14 13:43:04 +00:00
Sergey Biryukov
d1dbc3c69d Docs: Document the usage of $wpdb global in wp_get_post_autosave().
Follow-up to [48422].

Props ravivaddweb.
Fixes #51308. See #34560.
Built from https://develop.svn.wordpress.org/trunk@48975


git-svn-id: http://core.svn.wordpress.org/trunk@48737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-14 13:37:06 +00:00
Sergey Biryukov
f851814996 Tests: Correct assertion in Tests_DB::test_prepare_incorrect_arg_count().
On failure, `wpdb::prepare()` returns either an empty string or `null`, not `false`.

The test only passed accidentally due to `assertEquals()` not performing a strict type check.

Follow-up to [41662].

See #38266.
Built from https://develop.svn.wordpress.org/trunk@48974


git-svn-id: http://core.svn.wordpress.org/trunk@48736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-13 15:21:06 +00:00
Sergey Biryukov
7e2c6d63b7 Tests: Require PHP less than 8.0 for some wpdb tests.
These tests ensure that `wpdb::prepare()` throws a `_doing_it_wrong()` notice when called with an incorrect number of arguments, or with arguments of a wrong type.

PHP 8 introduces similar error messages natively, making these tests redundant on PHP 8.0 or later.

Follow-up to [41470], [41662].

See #50913.
Built from https://develop.svn.wordpress.org/trunk@48973


git-svn-id: http://core.svn.wordpress.org/trunk@48735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-13 02:49:06 +00:00
Sergey Biryukov
a2947f7054 Tests: Replace the native PHPUnit getMockForAbstractClass() and getMockBuilder() methods.
This avoids parse errors in PHPUnit internals due to `match` being a reserved keyword in PHP 8.

To run on PHP 8, the tests relying on these methods require PHPUnit 9.3 or later.

When the test suite is updated for compatibility with PHPUnit 9.x, these overrides can be removed.

See #50913, #50902.
Built from https://develop.svn.wordpress.org/trunk@48972


git-svn-id: http://core.svn.wordpress.org/trunk@48734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-13 02:38:07 +00:00
Sergey Biryukov
282c813259 Coding Standards: Explicitly declare the $wp_version global used in some core files.
Props jaydeep-rami, sabernhardt.
Fixes #44932.
Built from https://develop.svn.wordpress.org/trunk@48971


git-svn-id: http://core.svn.wordpress.org/trunk@48733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-12 00:12:08 +00:00
Sergey Biryukov
f29d62012d Coding Standards: Use strict comparison in wp-admin/includes/class-wp-plugin-install-list-table.php.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@48970


git-svn-id: http://core.svn.wordpress.org/trunk@48732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-11 01:05:08 +00:00
Helen Hou-Sandí
4e5211a691 REST API: Include attribute name in schema validation error message.
Props bobbingwide.
Fixes #51231.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-10 16:34:11 +00:00
Sergey Biryukov
e36c7f0ba0 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-plugins-list-table.php.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@48968


git-svn-id: http://core.svn.wordpress.org/trunk@48730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-10 14:23:08 +00:00
Sergey Biryukov
7dada5df2f Coding Standards: Use strict comparison in wp-admin/includes/class-wp-ms-themes-list-table.php.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@48967


git-svn-id: http://core.svn.wordpress.org/trunk@48729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-10 14:21:09 +00:00
John Blackbourn
526f0d01d4 Posts, Post Types: Don't output the adjacent posts rel link by default.
This has a considerable performance impact on sites which don't otherwise show previous and next post links, and has no SEO benefit.

Props joostdevalk, swissspidy, johnbillion

Fixes #39111
Built from https://develop.svn.wordpress.org/trunk@48966


git-svn-id: http://core.svn.wordpress.org/trunk@48728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 21:34:08 +00:00
Helen Hou-Sandí
447b526379 Privacy: Remove extraneous colon from settings screen.
Props vinita29, garrett-eclipse.
Fixes #50414.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 19:43:08 +00:00
desrosj
8e9e942215 Site Health: Allow attachments to be added to recovery mode emails.
The `wp_mail()` function has the ability to add attachments to emails. There is currently no way to add attachments to the recovery mode email sent out to site admins when a PHP error is encountered on their site.

This change adds that ability through the use of the `recovery_mode_email` filter, allowing developers to use the full capabilities of `wp_mail()`.

Props desrosj, timothyblynjacobs.
Fixes #51276.
Built from https://develop.svn.wordpress.org/trunk@48964


git-svn-id: http://core.svn.wordpress.org/trunk@48726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 16:21:06 +00:00
desrosj
04c8217724 Administration: Add the aria-hidden attribute to admin menu icons.
The admin menu icons are included as a visual element to support the text links. Without the `aria-hidden=“true”` attribute, they are also exposed to assistive technologies (which can process icon fonts in unpredictable ways).

This change improves the experience for multiple types of assistive technologies, including screen reading and voice control software. With `aria-hidden=“true”` added, the icons will not be read, and a user can now trigger a click of a top level admin menu item with commands such as “click posts”, or “click plugins”.

Props joedolson, afercia, audrasjb, adriantirusli.
Fixes #51012.
Built from https://develop.svn.wordpress.org/trunk@48963


git-svn-id: http://core.svn.wordpress.org/trunk@48725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 16:15:06 +00:00
desrosj
5be5b975c3 Docs: Improve the recovery_mode_email inline docs.
See #51267, #50768.
Built from https://develop.svn.wordpress.org/trunk@48962


git-svn-id: http://core.svn.wordpress.org/trunk@48724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 15:48:07 +00:00
Sergey Biryukov
649348cf5b Code Modernization: Remove unnecessary reference sign from get_comment() definition.
This fixes a PHP 8 "argument must be passed by reference, value given" error when using `array_map( 'get_comment', ... )`.

Object variables in PHP 5+ contain a reference to the object, and it's the reference that's passed around.

Note: This reverts [48838], which is now redundant.

Follow-up to a similar change for `get_post()` in [21572].

See #50913.
Built from https://develop.svn.wordpress.org/trunk@48961


git-svn-id: http://core.svn.wordpress.org/trunk@48723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 03:55:07 +00:00