This backports the PHPUnit Polyfills package and related test infrastructure changes to make it easier for developers to continue testing on multiple versions WordPress while adding tests for newer versions of PHP, which require more modern PHPUnit practices.
One of the changes included is the addition of wrappers for the new snake_case fixture methods in PHPUnit. This allows the native camelCase standard in PHPUnit to be used, but allows for developers to transition to the new naming conventions.
Props hellofromTonya, jrf, SergeyBiryukov, johnbillion, netweb, schlessera, jeherve, lucatume, desrosj.
Merges [51559,51560,51810-51813,51828] to the 5.7 branch.
See #53911.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@51839 602fd350-edb4-49c9-b593-d223f7449a82
When the XML-RPC endpoint is enabled, always return a HTTP `200 OK` status code in accordance with the XML-RPC specification. Continue to return an HTTP `405 Method Not Allowed` status code when the endpoint is disabled.
Props ariskataoka, johnbillion.
Merges [50954] in to the 5.7 branch.
Fixes#52958.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50989 602fd350-edb4-49c9-b593-d223f7449a82
Allow authenticated users to read the contents of password protected posts if they have the `edit_post` meta capability for the post.
Merges [50717] to the 5.7 branch.
Props xknown, zieladam, peterwilsoncc, swissspidy, timothyblynjacobs.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50718 602fd350-edb4-49c9-b593-d223f7449a82
Improve the check for sourceless or dimensionless media when determining if the lazy loading attribute should be added to iframes and images. Never include the lazy loading attribute on embeds of WordPress posts as the iframe is initially hidden.
Including `loading="lazy"` on initially hidden iframes and images can prevent the media from loading in some browsers.
Props adamsilverstein, fabianpimminger, flixos90, johnbillion, jonkastonka, joyously, peterwilsoncc, SergeyBiryukov, SirStuey, swissspidy.
Merges [50682], [50683] to the 5.7 branch.
Fixes#52768.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50684 602fd350-edb4-49c9-b593-d223f7449a82
When validating `enum` values as `integer` or `number`, consider a number with a zero fractional part to be equivalent to an integer of the same value.
In `rest_are_values_equal()`, when comparing two values of type `int` or `float` (in any combination), first cast both of them to `float` and then compare.
This matches some test cases from the official JSON Schema test suite.
Follow-up to [50010].
Props yakimun, stefanjoebstl, TimothyBlynJacobs, rachelbaker.
Merges [50653] to the 5.7 branch.
Fixes#52932.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50656 602fd350-edb4-49c9-b593-d223f7449a82
This backports a handful of test fixes related to generating code coverage reporting, as well as some `devDependency` updates.
Backports [50591-50595,50597-50598] to the 5.7 branch.
See #52624, #52786, #51734.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50601 602fd350-edb4-49c9-b593-d223f7449a82
Removes the mutually exclusive directives check in `wp_robots()`, ie allow both `follow` and `nofollow` to be specified and for `archive` and `noarchive` to be specified.
This fixes a bug in which WordPress would defer to the most permissive over the least permissive. When contradictory instructions are included, WordPress will defer to the search engine's or archivist's resolution policy: generally this is to observe the least, not most permissive.
Props Cybr, flixos90, SergeyBiryukov.
Merges [50566] to the 5.7 branch.
Fixes#52713.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50587 602fd350-edb4-49c9-b593-d223f7449a82
Add a check to `WP_REST_Meta_Fields::delete_meta_value()` ensuring meta data is set before attempting to delete it from the database. If the data does not exist, the delete is considered successful as the data matches the desired state.
Props BrechtVds, goaroundagain, TimothyBlynJacobs.
Merges [50567] to the 5.7 branch.
Fixes#52787.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50573 602fd350-edb4-49c9-b593-d223f7449a82
Update @wordpress npm packages to the latest published versions. This includes
block editor bug fixes for WordPress 5.7 RC 3.
See #52718.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50497 602fd350-edb4-49c9-b593-d223f7449a82
This changes the logic in `update_https_detection_errors()` to never store error messages from the actual request since they could use a different encoding, which would make storing them in an option potentially fail, leading WordPress to then falsely assume that HTTPS is supported.
While this doesn't actually fix the encoding issue, it is not crucial to do so anyway, since these messages are not used anywhere. A simple differentiation between whether the overall HTTPS request or only the SSL verification failed should be sufficient for the purpose of this function.
Props flixos90, tmatsuur, lukecarbis.
Reviewed by flixos90, SergeyBiryukov.
Merges [50471] to the 5.7 branch.
Fixes#52484.
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50472 602fd350-edb4-49c9-b593-d223f7449a82
* Switch back to running the PHPUnit test suite against the `src` directory instead of `build`
* Increase the reliability of backing up the `mu-plugins` directory during tests
* Split the PHPUnit tests for PHP versions below 7.0 in half, allowing them to run in parallel and reduce the overall test run duration on GitHub Actions
Merges [50441-50444] to the 5.7 branch.
Fixes#51734, #51735, #52645
git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50464 602fd350-edb4-49c9-b593-d223f7449a82
Move `wp_get_script_tag()`, `wp_print_script_tag()`, `wp_print_inline_script_tag()` and `wp_get_inline_script_tag()` functions from `functions.php` to `script-loader.php`.
Relocate related tests to `dependencies` sub-directory.
Follow up to [50167].
Props adamsilverstein, hellofromTonya, SergeyBiryukov.
Fixes#39941.
git-svn-id: https://develop.svn.wordpress.org/trunk@50409 602fd350-edb4-49c9-b593-d223f7449a82
Prevent `wp_localize_script()` (via `WP_Scripts::localize()`) throwing warnings in PHP 8 when the translation data is passed as a string. This maintains backward compatibility with earlier versions of PHP.
Introduce a `_doing_it_wrong()` notice to `WP_Scripts::localize()` if the translation data is not passed as an array.
Props jrf, peterwilsoncc, SergeyBiryukov.
Fixes#52534.
git-svn-id: https://develop.svn.wordpress.org/trunk@50408 602fd350-edb4-49c9-b593-d223f7449a82
Previously, only posts with the `publish` status could be embedded.
Props goaroundagain, peterwilsoncc, poena.
Fixes#47574.
git-svn-id: https://develop.svn.wordpress.org/trunk@50401 602fd350-edb4-49c9-b593-d223f7449a82
Prior to this changeset, the check for the correct RSD link output was relying on a specific protocol, although it needs to accept both the HTTP and HTTPS version of the URL.
Props TimothyBlynJacobs.
Fixes#52542. See #47577.
git-svn-id: https://develop.svn.wordpress.org/trunk@50391 602fd350-edb4-49c9-b593-d223f7449a82
Ensure that subsequent renders of a reusable block will render correctly and that recursively inserting a reusable block into itself does not cause an internal server (500) error.
Props bernhard-reiter, SergeyBiryukov.
Fixes#52364.
git-svn-id: https://develop.svn.wordpress.org/trunk@50382 602fd350-edb4-49c9-b593-d223f7449a82
In `unstick_post()` if a post ID is duplicated in the `sticky_posts` option remove all instances.
In both `stick_post()` and `unstick_post()` check for duplicate IDs already stored in the `sticky_post` option and remove them if the option is updated.
Props rahmohn, archon810.
Fixes#52007.
git-svn-id: https://develop.svn.wordpress.org/trunk@50380 602fd350-edb4-49c9-b593-d223f7449a82
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.
Follow-up to [49904], [49925], [49992], [50012], [50013], [50065], [50075], [50131], [50150], [50157].
See #38266, #52482.
git-svn-id: https://develop.svn.wordpress.org/trunk@50284 602fd350-edb4-49c9-b593-d223f7449a82
Rename `wp_force_plain_ugly_permalink()` to `wp_force_plain_post_permalink()` to match terminology used in the WordPress dashboard.
Follow up to [50132].
Props SergeyBiryukov.
Fixes#5272.
git-svn-id: https://develop.svn.wordpress.org/trunk@50282 602fd350-edb4-49c9-b593-d223f7449a82
Fixes a bug causing wp.i18n.isRTL() to return false in RTL langauges by manually
loading the translated 'ltr' string for the i18n dependency. This ports over an
identical fix that was made in Gutenberg.
Fixes#52441.
Props @jonsurrell @youknowriad.
git-svn-id: https://develop.svn.wordpress.org/trunk@50259 602fd350-edb4-49c9-b593-d223f7449a82