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
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
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
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
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
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
`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
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
#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
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
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
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
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
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
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