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