Commit Graph

42467 Commits

Author SHA1 Message Date
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
Peter Wilson
1ffdfdaea7 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.



git-svn-id: https://develop.svn.wordpress.org/trunk@49000 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-19 01:20:48 +00:00
Sergey Biryukov
2f491fba50 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48999 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 14:11:11 +00:00
Sergey Biryukov
ba20847ef5 Docs: Update the code example in WP_Ajax_UnitTestCase::dieHandler() DocBlock to use expectException().
Follow-up to [48996], [48997].

See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@48998 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 13:53:31 +00:00
Sergey Biryukov
5164bba5e2 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48997 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 13:48:27 +00:00
Sergey Biryukov
d46af0956d 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48996 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 13:22:22 +00:00
Sergey Biryukov
f78acee893 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48995 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 11:04:48 +00:00
Sergey Biryukov
8bc03cf494 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48994 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 11:01:52 +00:00
Sergey Biryukov
bc556578b3 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48993 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 10:56:27 +00:00
Sergey Biryukov
cb356d9cfc 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48992 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 10:42:26 +00:00
Sergey Biryukov
7d23a212c4 Docs: Update the URL for PHP date formats table in translator comments.
Props hareesh-pillai, iandunn.
Fixes #51332.

git-svn-id: https://develop.svn.wordpress.org/trunk@48991 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 10:35:41 +00:00
Sergey Biryukov
cb38bc973e 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48990 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 19:53:47 +00:00
Anthony Burchell
7da52b8eae 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.



git-svn-id: https://develop.svn.wordpress.org/trunk@48989 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 14:40:47 +00:00
Sergey Biryukov
f5fc714cf6 Tests: Move the data_wp_site_query_meta_query() data provider next to the test it's used in.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@48988 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 11:28:05 +00:00
Sergey Biryukov
64a0a9f108 Docs: Correct comments in comments_pre_query, networks_pre_query, and sites_pre_query tests.
Follow-up to [44983], [46086].

See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48987 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 11:18:39 +00:00
Sergey Biryukov
e145c9aaba Docs: Reformat comments_pre_query, networks_pre_query, sites_pre_query DocBlocks for better readability.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48986 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 11:08:04 +00:00
Sergey Biryukov
8621e8d5c8 Docs: Fix typo in *_pre_query filter DocBlocks.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48985 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 10:43:23 +00:00
Sergey Biryukov
77647aea23 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48984 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 10:35:51 +00:00
Sergey Biryukov
9cb0da3754 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48983 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 10:12:32 +00:00
Helen Hou-Sandi
9648bcd373 i18n: Ensure block type strings in the REST API end with a full stop.
Props ramiy, justinahinon.
Fixes #50805.



git-svn-id: https://develop.svn.wordpress.org/trunk@48982 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-16 19:21:03 +00:00
Sergey Biryukov
2cc4276746 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48981 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-16 02:27:42 +00:00
Sergey Biryukov
35ceac68f4 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.

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

git-svn-id: https://develop.svn.wordpress.org/trunk@48979 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-16 01:33:42 +00:00
Sergey Biryukov
b936a4131d Build/Test Tools: Restore the QUnit global in JSHint config for QUnit.
Follow-up to [47512], [48977].

See #51312, #37117.

git-svn-id: https://develop.svn.wordpress.org/trunk@48978 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-15 10:07:29 +00:00
Sergey Biryukov
d9514d19f1 Build/Test Tools: Remove unused legacy globals from JSHint config for QUnit.
Follow-up to [47512].

Props TimoTijhof.
Fixes #51312. See #37117.

git-svn-id: https://develop.svn.wordpress.org/trunk@48977 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-15 10:02:22 +00:00