Commit Graph

42602 Commits

Author SHA1 Message Date
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
Sergey Biryukov
7c60a660f1 Code Modernization: Correct the check for negative post IDs in WP_Query::parse_query() to work as expected on PHP 8.
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison

In particular, checking if an empty string is less than zero in PHP 8 evaluates to `true`, not `false`.

For `WP_Query`, this resulted in unintentionally returning a 404 error for most of front-end requests, instead of the relevant content.

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 [38288].

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


git-svn-id: http://core.svn.wordpress.org/trunk@48722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 02:35:06 +00:00
Sergey Biryukov
17a4c20d55 Comments: Check if a valid comment ID was passed when editing a comment.
This avoids a PHP notice after submitting the Edit Comment form.

Props regan.khadgi.
Fixes #51263.
Built from https://develop.svn.wordpress.org/trunk@48958


git-svn-id: http://core.svn.wordpress.org/trunk@48720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-08 13:41:08 +00:00
Sergey Biryukov
ed86c0da6c Build/Test Tools: Allow unit tests to run on PHP 8 in full.
PHP 8 introduces a new control structure called `match`, which makes `match` a reserved keyword in PHP 8.

One of the PHPUnit dependencies declares a class named `Match`, which triggered a fatal error before PHPUnit could even start.

To be able to use PHPUnit 7.x on PHP 8 and run the tests, core needs a new version of that dependency, which is now installed using Composer.

This is the simplest way to get things working again and start addressing the individual test failures.

Additionally, various test runs on PHP 8 on Travis are now performed individually instead of being chained, so that failures outside of WP scope don't block further execution.

Props jrf, jorbin, pento.
See #50902.
Built from https://develop.svn.wordpress.org/trunk@48957


git-svn-id: http://core.svn.wordpress.org/trunk@48719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-07 19:23:05 +00:00
Sergey Biryukov
f01b307dc1 Tests: Replace a few instances of assertNotEquals() with assertNotFalse().
See #38266.
Built from https://develop.svn.wordpress.org/trunk@48954


git-svn-id: http://core.svn.wordpress.org/trunk@48716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-07 04:13:09 +00:00
Sergey Biryukov
d52809e5f1 Tests: Remove the polyfill for assertNotFalse().
`assertNotFalse()` is available in PHPUnit since version 4.0.

The polyfill was introduced back when WordPress still supported PHP 5.2 and PHPUnit 3.6.x, and is now redundant.

Follow-up to [39919], [45058], [47880].

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


git-svn-id: http://core.svn.wordpress.org/trunk@48715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-07 03:28:04 +00:00
Sergey Biryukov
cb67321277 Tests: Add a polyfill for assertEqualsWithDelta() to WP_UnitTestCase and use it where appropriate.
`assertEqualsWithDelta()` was added in PHPUnit 7.5, while WordPress still supports PHPUnit 5.4.x as the minimum version.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-07 03:14:04 +00:00
TimothyBlynJacobs
55c21acc9f REST API: Extract WP_REST_Controller::get_endpoint_args_for_item_schema() to a standalone function.
This method is useful whenever a JSON Schema needs to be converted to a format suitable for argument validation with `WP_REST_Request`. Moving the logic into a standalone function allows developers to use it outside of the `WP_REST_Controller` context.

Props pentatonicfunk.
Fixes #50876. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@48713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-07 02:37:07 +00:00
Sergey Biryukov
6cbbd32eb5 Tests: Add a test case for storing false in the cache.
Follow-up to [20089], [48949].

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


git-svn-id: http://core.svn.wordpress.org/trunk@48712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-06 04:25:04 +00:00
Sergey Biryukov
b4e2dc1331 Tests: Correct assertion in Tests_Cache::test_add_get_null().
It is possible to store `null` in the cache without it being converted to an empty string.

Follow-up to [20089].

Props johnbillion, SergeyBiryukov.
See #38266.
Built from https://develop.svn.wordpress.org/trunk@48949


git-svn-id: http://core.svn.wordpress.org/trunk@48711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-06 03:37:04 +00:00
Sergey Biryukov
628a149789 Tests: Correct assertion in Tests_Cache::test_miss().
On failure to retrieve contents, `WP_Object_Cache::get()` returns `false`, not `null`.

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

Props johnbillion.
See #38266.
Built from https://develop.svn.wordpress.org/trunk@48948


git-svn-id: http://core.svn.wordpress.org/trunk@48710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-06 02:53:08 +00:00
TimothyBlynJacobs
a63708debf REST API: Refactor WP_REST_Server::dispatch() to make internal logic reusable.
#50244 aims to introduce batch processing in the REST API. An important feature is the ability to enforce that all requests have valid data before executing the route callbacks in "pre-validate" mode.

This necessitates splitting `WP_REST_Server::dispatch()` into two methods so the batch controller can determine the request handler to perform pre-validation and then respond to the requests.

The two new methods, `match_request_to_handler` and `respond_to_request`, have a public visibility, but are marked as `@access private`. This is to allow for iteration on the batch controller to happen in the Gutenberg repository. Developers should not rely upon these methods, their visibility may change in the future.

See #50244.
Props andraganescu, zieladam, TimothyBlynJacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-05 21:52:07 +00:00
Sergey Biryukov
93b8183327 Media: In wp_ajax_image_editor(), check if the error property exists before accessing it.
This avoids a PHP notice when editing an image.

Follow-up to [48375].

Props Mista-Flo.
Fixes #51251.
Built from https://develop.svn.wordpress.org/trunk@48946


git-svn-id: http://core.svn.wordpress.org/trunk@48708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-05 18:12:08 +00:00
TimothyBlynJacobs
f43ca27db9 REST API: Support a route-level validation callback.
Most request data is validated on a per-parameter basis. Often, however, additional validation is needed that operates on the entire request object. Currently, this is done in the route callback and often in the `prepare_item_for_database` method specifically.

#50244 aims to introduce batch processing in the REST API. An important feature is the ability to enforce that all requests have valid data before executing the route callbacks in "pre-validate" mode.

This patch introduces support for calling a `validate_callback` after all parameter validation has succeeded. That allows moving more validation outside of the route callback and into `WP_REST_Request` which will improve "pre-validate" support.

Props TimothyBlynJacobs, zieladam.
Fixes #51255.
See #50244.



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


git-svn-id: http://core.svn.wordpress.org/trunk@48707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-05 18:09:06 +00:00
Sergey Biryukov
63b15a6fd6 Tests: Replace a few more instances of assertEquals() with assertSame().
These were previously missed due to incorrect capitalization.

Follow-up to [48937], [48939], [48940].

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


git-svn-id: http://core.svn.wordpress.org/trunk@48706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-05 16:49:07 +00:00
Sergey Biryukov
e05edbcd53 Comments: Rename WP_Comments_List_Table::comment_status_dropdown() to ::comment_type_dropdown().
This better reflects the purpose of the method, which doesn't have anything to do with a comment status.

Follow-up to [48521].

Props davidbaumwald, johnbillion, SergeyBiryukov.
Fixes #51248.
Built from https://develop.svn.wordpress.org/trunk@48943


git-svn-id: http://core.svn.wordpress.org/trunk@48705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-05 00:33:05 +00:00
Sergey Biryukov
dd03a5a156 Docs: Further correct placement for wp_editor_expand filter DocBlock.
This ensures that the filter is only applied if the conditions before it are evaluated to true.

Follow-up to [48714].

Props johnbillion.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48942


git-svn-id: http://core.svn.wordpress.org/trunk@48704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-04 21:48:07 +00:00
John Blackbourn
d0a32c5111 Docs: Various docblock corrections and improvements.
See #50768
Built from https://develop.svn.wordpress.org/trunk@48941


git-svn-id: http://core.svn.wordpress.org/trunk@48703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-04 20:41:07 +00:00
Sergey Biryukov
7ad3a59ca4 Tests: Replace a few more instances of assertEquals() with assertSame().
These were previously missed due to incorrect capitalization.

Follow-up to [48937], [48939].

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


git-svn-id: http://core.svn.wordpress.org/trunk@48702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-04 07:38:06 +00:00
Sergey Biryukov
fab9a6e435 Tests: Introduce assertSameSets() and assertSameSetsWithIndex(), and use them where appropriate.
This ensures that not only the array values being compared are equal, but also that their type is the same.

These new methods replace most of the existing instances of `assertEqualSets()` and `assertEqualSetsWithIndex()`.

Going forward, stricter type checking by using `assertSameSets()` or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable.

Follow-up to [48937].

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


git-svn-id: http://core.svn.wordpress.org/trunk@48701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-04 07:02:05 +00:00
Sergey Biryukov
6d0491119e Administration: Give the $error variable in wp-admin/admin-header.php a more descriptive name.
This avoids a conflict with the same global variable used elsewhere, e.g. in Theme Editor.

Follow-up to [48850].

Props vinayak.anivase.
Fixes #51219.
Built from https://develop.svn.wordpress.org/trunk@48938


git-svn-id: http://core.svn.wordpress.org/trunk@48700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-03 01:43:07 +00:00
Sergey Biryukov
831c62ea8e Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.
Built from https://develop.svn.wordpress.org/trunk@48937


git-svn-id: http://core.svn.wordpress.org/trunk@48699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-02 00:37:09 +00:00
Sergey Biryukov
675f4fa43a General: Set svn:eol-style for phpunit/includes/normalize-xml.xsl.
Follow-up to [48072], [48845].

See #51113.
Built from https://develop.svn.wordpress.org/trunk@48931


git-svn-id: http://core.svn.wordpress.org/trunk@48693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-01 16:50:09 +00:00
Sergey Biryukov
593624f182 General: Correct reversed svn:auto-props for .mo and .po files.
* `.mo` files are binary and should have `svn:mime-type=application/octet-stream`.
* `.po` files are text and should have `svn:eol-style=native`, same as `.pot` files.

Follow-up to [46636], [48845].

See #51113.
Built from https://develop.svn.wordpress.org/trunk@48930


git-svn-id: http://core.svn.wordpress.org/trunk@48692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-01 16:40:08 +00:00
Sergey Biryukov
0418dad234 Docs: Synchronize the description of the $format parameter in various date/time functions for posts and comments.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48929


git-svn-id: http://core.svn.wordpress.org/trunk@48691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-01 00:43:06 +00:00
Sergey Biryukov
2df5ec1234 Tests: Move the tests for get_the_modified_time() to a more appropriate place.
Add some new tests to better cover the functionality, for consistency with `get_the_date()` and `get_the_time()`.

Follow-up to [48911], [48912], [48918].

Props wittich.
Fixes #51184.
Built from https://develop.svn.wordpress.org/trunk@48924


git-svn-id: http://core.svn.wordpress.org/trunk@48686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 22:43:05 +00:00
Sergey Biryukov
68dfbf51d9 Script Loader: Add backward compatibility for JavaScript i18n globals and properties deprecated in WordPress 5.5.
The recommended approach for any plugins using these globals or properties is to switch to the newer `wp.i18n` functions.

In the meantime, this ensures that accessing any of these globals does not break the rest of the code on the page, and an appropriate warning message is logged to the JavaScript console.

Follow-up to: https://core.trac.wordpress.org/query?summary=~wp.i18n&milestone=5.5

Props omarreiss, peterwilsoncc, kbjohnson90, johnbillion, TimothyBlynJacobs, joostdevalk, ocean90, desrosj, SergeyBiryukov.
Fixes #51123.
Built from https://develop.svn.wordpress.org/trunk@48923


git-svn-id: http://core.svn.wordpress.org/trunk@48685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 20:30:03 +00:00
Sergey Biryukov
d3abb209e1 Date/Time: In get_the_date() and related functions, pass the original, unmodified $format value to the filters.
Additionally, simplify the `$format` argument checks for consistency with similar checks in `get_the_modified_date()` and `get_the_modified_time()`.

Follow-up to [48912].

Props Rarst.
See #51184.
Built from https://develop.svn.wordpress.org/trunk@48918


git-svn-id: http://core.svn.wordpress.org/trunk@48680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 18:30:05 +00:00
Sergey Biryukov
d4d3e23ad0 Themes: Normalize the installed theme path in Theme_Installer_Skin::do_overwrite() before comparing with the uploaded theme.
This ensures that the data for the currently installed theme is picked up properly when uploading a theme update on Windows.

Follow-up to [48390].

Props bobbingwide, wpamitkumar, mukesh27.
Fixes #51182.
Built from https://develop.svn.wordpress.org/trunk@48913


git-svn-id: http://core.svn.wordpress.org/trunk@48675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 17:11:04 +00:00
Sergey Biryukov
aec28121b3 Date/Time: Make sure get_the_date() and related functions return correct time if the format was specified as false.
Technically, the `$format` argument should always be a string, but passing `false` used to work before [47808], so this restores backward compatibility.

The list of affected functions:
* `get_the_date()`
* `get_the_time()`
* `get_comment_date()`
* `get_comment_time()`

Props wittich, Rarst, akabarikalpesh, SergeyBiryukov.
Fixes #51184.
Built from https://develop.svn.wordpress.org/trunk@48912


git-svn-id: http://core.svn.wordpress.org/trunk@48674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 15:58:04 +00:00
Sergey Biryukov
e501d8ead8 Tests: Bring some consistency to Date/Time tests:
* Move some tests from `post.php` to a more appropriate location in the `date` directory.
* Rename `date/postTime.php` to `date/getPostTime.php` to match the function name.

Props Rarst.
See #51184.
Built from https://develop.svn.wordpress.org/trunk@48911


git-svn-id: http://core.svn.wordpress.org/trunk@48673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 15:35:05 +00:00
Sergey Biryukov
ee33a7b019 Docs: Add a @since note to the display_post_states filter to clarify that it is now also applied in the Customizer context.
If any admin functions are used within the filter, their existence should be checked with `function_exists()` before being used.

Follow-up to [47763], [48620].

Props audrasjb, garrett-eclipse, Howdy_McGee, dlh, khag7, SergeyBiryukov.
Fixes #51081.
Built from https://develop.svn.wordpress.org/trunk@48910


git-svn-id: http://core.svn.wordpress.org/trunk@48672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 13:32:04 +00:00
Sergey Biryukov
94555079eb Docs: Clarify the usage of null for auto_update_{$type} filter.
The value is internally used to detect whether nothing has hooked into this filter.

Props audrasjb, pbiron, johnbillion, SergeyBiryukov.
Fixes #50848.
Built from https://develop.svn.wordpress.org/trunk@48909


git-svn-id: http://core.svn.wordpress.org/trunk@48671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 13:20:07 +00:00
Sergey Biryukov
06fc8fa3f5 Tests: Reset the $wp_sitemap global after each test, so that sitemaps are re-initialized when the next test runs.
This ensures consistent results in query var tests, regardless of whether they are run in isolation or as part of a larger group of tests.

Props pbiron, peterwilsoncc.
Fixes #51154.
Built from https://develop.svn.wordpress.org/trunk@48908


git-svn-id: http://core.svn.wordpress.org/trunk@48670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-31 03:59:05 +00:00
Sergey Biryukov
ccd5fc2c8f Tests: Move the tests for selected() and checked() to a more appropriate place.
Convert the tests to use data providers.

Props wittich.
Fixes #51166.
Built from https://develop.svn.wordpress.org/trunk@48907


git-svn-id: http://core.svn.wordpress.org/trunk@48669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-30 01:36:08 +00:00
Sergey Biryukov
be4ad8548c Administration: Correct the padding for "Warning: these pages should not be the same" messages on Reading Settings screen.
Replace the legacy `.error` class with a more appropriate `.notice-warning`.

Props musicaljoeker, shital-patel, man4toman, garrett-eclipse, SergeyBiryukov.
Fixes #50766.
Built from https://develop.svn.wordpress.org/trunk@48906


git-svn-id: http://core.svn.wordpress.org/trunk@48668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-29 00:42:05 +00:00
Sergey Biryukov
af523447f4 Media: Make the is_gd_image() function available on front end.
This avoids a fatal error if a plugin calls image creation or editing functions like `wp_imagecreatetruecolor()` outside of the admin.

Follow-up to [48798]

Props BackuPs.
Fixes #51174. See #50833.
Built from https://develop.svn.wordpress.org/trunk@48905


git-svn-id: http://core.svn.wordpress.org/trunk@48667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-28 16:45:06 +00:00