Commit Graph

42491 Commits

Author SHA1 Message Date
Sergey Biryukov 21eb2f0d98 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49050 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 02:32:25 +00:00
Sergey Biryukov ce87b260bc 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49049 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 01:09:52 +00:00
John Blackbourn 5346800a92 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


git-svn-id: https://develop.svn.wordpress.org/trunk@49048 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 22:31:27 +00:00
Sergey Biryukov 5d1a29deaa 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49047 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 02:21:33 +00:00
Sergey Biryukov 51a7210589 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49046 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 02:09:32 +00:00
Sergey Biryukov 5730b983b8 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49045 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 01:43:19 +00:00
Sergey Biryukov 3bfa4606c7 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49044 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 01:29:51 +00:00
Sergey Biryukov da93663d01 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49043 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 00:02:39 +00:00
Sergey Biryukov 0ae6b563b6 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49042 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-24 04:58:27 +00:00
Robert Anderson 28963e897c Documentation: Add 'template' arg documentation
Add inline documentation for the 'template' arg accepted by
register_post_type().

Props milana_cap.
See #46261.


git-svn-id: https://develop.svn.wordpress.org/trunk@49041 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-24 03:10:26 +00:00
Robert Anderson 165adab5e7 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@49040 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-24 02:58:17 +00:00
Sergey Biryukov 185ad1e116 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49039 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-23 18:37:09 +00:00
Sergey Biryukov 7826f31e26 Docs: Remove obsolete `$wpdb` global reference from `get_site_by_path()`.
Follow-up to [37628].

Props ravivaddweb, mukesh27.
Fixes #51380.

git-svn-id: https://develop.svn.wordpress.org/trunk@49038 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-23 14:09:03 +00:00
Sergey Biryukov c31a551273 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49037 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-23 13:52:02 +00:00
Sergey Biryukov 7d15225ad0 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49036 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-23 00:25:47 +00:00
Jonathan Desrosiers 83eb948b7f Privacy: Ensure bulk action related strings end with periods.
Props garrett-eclipse, mukesh27.
Fixes #51371.

git-svn-id: https://develop.svn.wordpress.org/trunk@49035 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-22 18:38:51 +00:00
Jonathan Desrosiers 45197f9d4e 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49034 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-22 18:35:10 +00:00
Sergey Biryukov 303deffe91 Tests: Use consistent trailing punctuation in `fail()` messages.
See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49033 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-22 12:32:39 +00:00
Sergey Biryukov a9ee47c806 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49032 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-22 12:30:48 +00:00
Timothy Jacobs c263d2e56c REST API: Regenerate test fixtures after [48982].
Props garrett-eclipse.
Fixes #50805.


git-svn-id: https://develop.svn.wordpress.org/trunk@49031 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 22:52:29 +00:00
Sergey Biryukov e8617468a2 Tests: Fix typo in some `markTestSkipped()` messages.
See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49030 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 20:18:20 +00:00
John Blackbourn 4a929fe723 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


git-svn-id: https://develop.svn.wordpress.org/trunk@49029 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 17:14:33 +00:00
John Blackbourn 0fbc8b1ac7 Docs: Correct the indentation for some array type docs.
See #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49028 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 16:44:35 +00:00
Sergey Biryukov 310799a268 Tests: Use consistent trailing punctuation in `markTestSkipped()` messages.
See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49027 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 14:05:23 +00:00
Sergey Biryukov e8b00da747 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49026 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 13:49:07 +00:00
Sergey Biryukov 6242c634ee 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49025 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 13:25:38 +00:00
Sergey Biryukov b984a64c98 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49024 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 11:34:06 +00:00
Sergey Biryukov f7570fec4a General: Give the `$is` variable in `is_wp_error()` a more descriptive name.
Follow-up to [49022].

See #40568.

git-svn-id: https://develop.svn.wordpress.org/trunk@49023 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 11:11:10 +00:00
John Blackbourn 2b742beb5c 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



git-svn-id: https://develop.svn.wordpress.org/trunk@49022 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 17:43:00 +00:00
John Blackbourn dd076bb611 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


git-svn-id: https://develop.svn.wordpress.org/trunk@49021 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 16:21:42 +00:00
John Blackbourn b620440519 Docs: Inline documentation improvements for media related functions and hooks.
See #47364, #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49020 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 15:53:52 +00:00
Sergey Biryukov e020b1183d 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49019 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 14:26:38 +00:00
Sergey Biryukov 8856579610 Tests: Correctly unset non-supported image editor engines in some image tests.
Follow-up to [49009], [49014].

See #50639, #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49018 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 14:13:04 +00:00
John Blackbourn ab25da99a0 Media: Correct some types for attachment ID parameters passed to functions and filters.
See #47364, #50768 


git-svn-id: https://develop.svn.wordpress.org/trunk@49017 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 14:03:17 +00:00
John Blackbourn db684af2c1 Media: Correct some types in docblocks for filters related to thumbnails.
Props dilipbheda

See #47364, #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49016 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 13:38:04 +00:00
Sergey Biryukov e92ddaa2c3 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49015 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 13:31:08 +00:00
Sergey Biryukov 68b71263f3 Tests: Optimize some image tests to avoid checking for image editor engines availability twice.
Follow-up to [49009].

See #50639, #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49014 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 13:25:07 +00:00
John Blackbourn 42019042de I18N: Add a language icon next to the Default Language network option.
Fixes #51359


git-svn-id: https://develop.svn.wordpress.org/trunk@49013 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 13:16:12 +00:00
John Blackbourn 9462c458ff 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


git-svn-id: https://develop.svn.wordpress.org/trunk@49012 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 13:13:46 +00:00
John Blackbourn 74688add2c 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


git-svn-id: https://develop.svn.wordpress.org/trunk@49011 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 12:01:32 +00:00
Sergey Biryukov 8493793928 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49010 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 03:31:46 +00:00
Sergey Biryukov 58385f1402 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49009 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 02:45:35 +00:00
Sergey Biryukov 2bfa83d882 Coding Standards: Fix WPCS issue in [49007].
See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49008 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 01:16:57 +00:00
Sergey Biryukov cdd15a8f77 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49007 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 00:55:07 +00:00
Sergey Biryukov 835e9c48a4 Tests: Add missing `@covers` tags for files in `phpunit/tests/functions/`.
Props pbearne, jrf.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@49006 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-19 15:52:03 +00:00
Sergey Biryukov 898eb5fc51 Tests: Speed up slashed data tests by reusing some more shared fixtures.
Follow-up to [35249], [49003].

See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49005 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-19 11:11:00 +00:00
Sergey Biryukov 4018e92c39 Coding Standards: Give the `$id` variable in slashed data tests a more descriptive name.
See #50767, #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49004 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-19 10:53:15 +00:00
Sergey Biryukov ffc129395c Tests: Speed up slashed data tests by reusing shared fixtures.
Follow-up to [35249].

See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49003 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-19 10:34:54 +00:00
Sergey Biryukov 0c5324df3b Tests: Speed up tests for `wp_allow_comment()` by reusing shared fixtures.
Props frank-klein.
Fixes #51216.

git-svn-id: https://develop.svn.wordpress.org/trunk@49002 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-19 09:25:55 +00:00
Sergey Biryukov 1ec9dc6fa4 Tests: Simplify the logic in `WP_UnitTestCase_Base::setUpBeforeClass()` and `::tearDownAfterClass()`.
See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49001 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-19 09:11:23 +00:00