This avoids a fatal error on PHP 8 caused by passing a zero value to `fread()` as the `$length` argument, which must be greater than zero.
This commit also amends the previous solution for similar issues elsewhere in the file to ensure consistent type for string values, instead of changing the type from `string` to `bool` when trying to read from an empty file.
Follow-up to [50355].
Props DavidAnderson, jrf, SergeyBiryukov.
Fixes#54036.
git-svn-id: https://develop.svn.wordpress.org/trunk@51686 602fd350-edb4-49c9-b593-d223f7449a82
This makes the use of Composer on the host machine optional when using the Docker environment, which means there is no change to the process for installing, updating, and running the tests since [51559].
Props hellofromTonya, azaozz, netweb, desrosj, jrf, johnbillion
Fixes#53945
git-svn-id: https://develop.svn.wordpress.org/trunk@51685 602fd350-edb4-49c9-b593-d223f7449a82
This prevents unclickable areas within the menu from appearing clickable.
Props circlecube, kurudrive, ryelle, opurockey
Fixes#51551
git-svn-id: https://develop.svn.wordpress.org/trunk@51684 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a "Misleading line break before `'||'`; readers may interpret this as an expression boundary" error.
See #54030.
git-svn-id: https://develop.svn.wordpress.org/trunk@51683 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that the current panel is not collapsed when hitting `Esc` with the focus on the widget block editor.
Follow-up to [37347], [39120].
Props gwwar, dlh.
Fixes#54030.
git-svn-id: https://develop.svn.wordpress.org/trunk@51682 602fd350-edb4-49c9-b593-d223f7449a82
Installation and activation of incompatible plugins was previously disallowed in [43436] and [44978], but if such a plugin was installed manually, there was nothing on the Plugins screen that would show its compatibility status.
Showing an appropriate notice with a documentation link makes the UI more consistent and improves user experience.
Follow-up to [43436], [44937], [44939], [44978], [45043], [45165], [45546], [47573], [47816], [47819], [48172], [48636], [48637], [48638], [48640], [48652], [48653], [48654], [48660].
Props TacoVerdo, SergeyBiryukov.
Fixes#53990.
git-svn-id: https://develop.svn.wordpress.org/trunk@51678 602fd350-edb4-49c9-b593-d223f7449a82
Disables Customizer animations when media query `prefers-reduced-motion: reduce` returns true.
Continues the effort to reduce motion within the WordPress admin panel when users have enabled this feature in their operating system or browser.
It has the additional effect of making the Block Editor's end-to-end tests run faster, as explored initially with a different approach in #53562.
See https://github.com/WordPress/gutenberg/issues/32024 for the related Gutenberg issue.
See https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion for ways to enable this feature on various platforms.
Props kevin940726, isabel_brison, zieladam, youknowriad, desrosj, mamaduka, mikeschroder.
Previously [51389], [50028], [47813].
Fixes#53542.
git-svn-id: https://develop.svn.wordpress.org/trunk@51677 602fd350-edb4-49c9-b593-d223f7449a82
The `serializeAttributes()` function in JavaScript uses `JSON.stringify`, which does not encode slashes and unicode characters by default. This resulted in the PHP serialization through `json_encode()` producing different results.
This also switches from `json_encode()` to `wp_json_encode()` to prevent failures when any non UTF-8 characters are included.
Props kevinfodness, SergeyBiryukov, timothyblynjacobs.
Fixes#53936.
git-svn-id: https://develop.svn.wordpress.org/trunk@51674 602fd350-edb4-49c9-b593-d223f7449a82
This is the correct formatting detailed in the Docker `compose` documentation examples and helps to avoid ambiguities in the yaml parser when values that may cause warnings.
Props pbrearne, ocean90, johnbillion, desrosj.
Fixes#53820.
git-svn-id: https://develop.svn.wordpress.org/trunk@51673 602fd350-edb4-49c9-b593-d223f7449a82
This new custom property, `--wp-admin--admin-bar--height`, reflects the admin bar's height and adjusts responsively on smaller screens. It can be used to offset content to avoid overlapping the admin bar, without needing to copy the media query.
This also removes a workaround only needed for Internet Explorer 6 and below.
Props nico23, sabernhardt.
Fixes#52623.
git-svn-id: https://develop.svn.wordpress.org/trunk@51672 602fd350-edb4-49c9-b593-d223f7449a82
bash is the default shell for all non-Windows GitHub Action runners, so this is not necessary.
Follow up to [51670].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51671 602fd350-edb4-49c9-b593-d223f7449a82
The PHPUnit tests are/should generally be run on the `src` directory, so changes just made can be tested. While testing via the `build` directory is also still supported, this is not the default.
This was last changed in [50441], but that commit did not remove/update the error message thrown by the test bootstrap file.
This last change also did not take into account that that change meant that people had to update their own `wp`tests-config.php` file to match the change made in Core and would otherwise still get the outdated error message.
This commit changes the messaging in the test bootstrap file to be more in line with the current reality, while still accounting for the fact that tests can be run from both `src` as well as `build`.
Follow-up to [49569], [50441], [51581].
Props jrf, hellofromTonya.
git-svn-id: https://develop.svn.wordpress.org/trunk@51669 602fd350-edb4-49c9-b593-d223f7449a82
The tests were partially duplicated in two separate files, and are now located in their own file.
Follow-up to [431/tests], [28900], [38928], [42527], [51663].
See #53363, #53987.
git-svn-id: https://develop.svn.wordpress.org/trunk@51664 602fd350-edb4-49c9-b593-d223f7449a82
The WPCS sniff already takes the test classes in the `tests/phpunit/includes` directory into account.
Only the test cases outside of that directory, i.e. in the `tests/phpunit/tests` directory need to be listed here.
Includes alphabetizing the list.
Follow-up to [42346], [45607].
Props jrf, hellofromTonya, SergeyBiryukov.
See #53359.
git-svn-id: https://develop.svn.wordpress.org/trunk@51659 602fd350-edb4-49c9-b593-d223f7449a82
When a closure does not use `$this`, it can be made `static` for improved performance.
Static closures are supported in PHP since PHP 5.4.
Props jrf, hellofromTonya, swissspidy, SergeyBiryukov.
See #53359.
git-svn-id: https://develop.svn.wordpress.org/trunk@51657 602fd350-edb4-49c9-b593-d223f7449a82
This matches the `WP_Upgrader::download_package()` documentation more closely.
Follow-up to [44954], [45262].
See #53399.
git-svn-id: https://develop.svn.wordpress.org/trunk@51655 602fd350-edb4-49c9-b593-d223f7449a82
This matches the `WP_Upgrader::download_package()` documentation more closely.
Follow-up to [11005], [30758], [33685].
See #53399.
git-svn-id: https://develop.svn.wordpress.org/trunk@51654 602fd350-edb4-49c9-b593-d223f7449a82
The `WP_Sitemaps_Provider::get_sitemap_url()` method calls the PHP native `http_build_query()` function, the second parameter of which is the ''optional'' `$numeric_prefix` parameter which expects a `string`.
A parameter being optional, however, does not automatically make it nullable.
As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.
In this case, this function call yielded a `http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated` notice.
Changing the `null` to an empty string fixes this without a backward compatibility break.
This change is already covered by tests as 14 of the existing tests failed on these function calls when running the tests on PHP 8.1.
References:
* [https://www.php.net/manual/en/function.http-build-query.php PHP Manual: http_build_query()]
* [https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg PHP RFC: Deprecate passing null to non-nullable arguments of internal functions]
Follow-up to [48470].
Props jrf.
See #53635.
git-svn-id: https://develop.svn.wordpress.org/trunk@51652 602fd350-edb4-49c9-b593-d223f7449a82
This gives more context to GitHub Action related Slack messages without the need to click the workflow URL, or unfurl the links (which shows lots of unnecessary information, such as the repository description and image).
Props earnjam.
See #52644.
git-svn-id: https://develop.svn.wordpress.org/trunk@51647 602fd350-edb4-49c9-b593-d223f7449a82
Sometimes the submit button wraps to a new line, either because the button label translation is long, or there are long page names. When it wraps, there should be space between the select dropdown and the button.
Props audrasjb, mukesh27, guillaumeturpin.
Fixes#53782.
git-svn-id: https://develop.svn.wordpress.org/trunk@51645 602fd350-edb4-49c9-b593-d223f7449a82
When transition is `all`, it also applies to the icon size, which can cause a bug in Safari where icons get stuck in the wrong size when resizing the browser window. The only expected animation is on the color property, so the transition can be limited to just `color`.
Props johnjamesjacoby, sabernhardt, SergeyBiryukov, audrasjb.
Fixes#43423.
git-svn-id: https://develop.svn.wordpress.org/trunk@51644 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that the class is loaded once before the first test of the test case class is run, and `require_once()` is not unnecessarily called for each test method individually.
Follow-up to [40607], [51628].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51641 602fd350-edb4-49c9-b593-d223f7449a82
The following warnings could, in very select circumstances, be shown:
{{{
// PHP 8.0 and higher:
Warning: foreach() argument must be of type array|object, bool given
// PHP 5.6 – 7.4
Warning: Invalid argument supplied for foreach()
}}}
In `WP_Media_List_Table::prepare_items()`, the cron info array is retrieved via a call to `_get_cron_array()`, but as the documentation (correctly) states, the return type of that function is `array|false`, where `false` is returned for a virgin site, with no cron jobs scheduled yet.
However, no type check is done on the return value, and the method just blindly continues by using it in a `foreach`.
Fixed by adding validation for the returned value from `_get_cron_array()` and only running the `foreach` when the returned value is an array.
Reference: [https://developer.wordpress.org/reference/functions/_get_cron_array/ WordPress Developer Resources: _get_cron_array()]
Follow-up to [48417].
Props jrf, hellofromTonya, mukesh27.
Fixes#53949.
git-svn-id: https://develop.svn.wordpress.org/trunk@51638 602fd350-edb4-49c9-b593-d223f7449a82
Hide the browser's native radio button on the custom background position selector in the Customizer and the legacy background screen. This fixes an issue causing both to display.
Props mukesh27, ravipatel, sabernhardt, walbo.
Fixes#53803.
git-svn-id: https://develop.svn.wordpress.org/trunk@51637 602fd350-edb4-49c9-b593-d223f7449a82
Since PHP 8.1, the `auto_detect_line_endings` setting is deprecated:
> The `auto_detect_line_endings` ini setting modifies the behavior of `file()` and `fgets()` to support an isolated `\r` (as opposed to `\n` or `\r\n`) as a newline character. These newlines were used by “Classic” Mac OS, a system which has been discontinued in 2001, nearly two decades ago. Interoperability with such systems is no longer relevant.
Reference: [https://wiki.php.net/rfc/deprecations_php_8_1#auto_detect_line_endings_ini_setting PHP RFC: Deprecations for PHP 8.1: auto_detect_line_endings ini setting]
> The `auto_detect_line_endings` ini setting has been deprecated. If necessary, handle `\r` line breaks manually instead.
Reference: [1cf4fb739f/UPGRADING (L456-L457) PHP 8.1 Upgrade Notes].
This commit fixes the warning when running tests for the `PO` class:
{{{
Deprecated: auto_detect_line_endings is deprecated in /var/www/src/wp-includes/pomo/po.php on line 16
}}}
While deprecated, the actual `auto_detect_line_endings` functionality has not been removed from PHP (yet) and will still work until PHP 9.0.
For now, we're silencing the deprecation notice as there may still be translation files around which haven't been updated in a long time and which still use the old MacOS standalone `\r` as a line ending.
This should be revisited when PHP 9.0 is in alpha/beta.
Follow-up to [51633].
Props jrf.
See #53635.
git-svn-id: https://develop.svn.wordpress.org/trunk@51636 602fd350-edb4-49c9-b593-d223f7449a82
Since PHP 8.1, the `auto_detect_line_endings` setting is deprecated:
> The `auto_detect_line_endings` ini setting modifies the behavior of `file()` and `fgets()` to support an isolated `\r` (as opposed to `\n` or `\r\n`) as a newline character. These newlines were used by “Classic” Mac OS, a system which has been discontinued in 2001, nearly two decades ago. Interoperability with such systems is no longer relevant.
Reference: [https://wiki.php.net/rfc/deprecations_php_8_1#auto_detect_line_endings_ini_setting PHP RFC: Deprecations for PHP 8.1: auto_detect_line_endings ini setting]
> The `auto_detect_line_endings` ini setting has been deprecated. If necessary, handle `\r` line breaks manually instead.
Reference: [1cf4fb739f/UPGRADING (L456-L457) PHP 8.1 Upgrade Notes].
This commit fixes the warning when running tests for the `PO` class:
{{{
Deprecated: auto_detect_line_endings is deprecated in /var/www/src/wp-includes/pomo/po.php on line 16
}}}
Follow-up to [10584], [51628].
See #53635.
git-svn-id: https://develop.svn.wordpress.org/trunk@51633 602fd350-edb4-49c9-b593-d223f7449a82
Increase the number of media items displayed per page from 40 to 80 to improve the experience for users navigating the library on sites with a large quantity of media in the library.
Props AlGala, antpb, hellofromTonya, joedolson, SergeyBiryukov, wb1234.
Fixes#53827.
git-svn-id: https://develop.svn.wordpress.org/trunk@51632 602fd350-edb4-49c9-b593-d223f7449a82
Reduces the right margin of the media library modal on small and medium width screens to remove excess white-space. On very narrow screens this was preventing the media icons from displaying.
Props andraganescu, desrosj, joedolson, moch11, mukesh27, sabernhardt, SergeyBiryukov, zieladam.
Fixes#53679.
git-svn-id: https://develop.svn.wordpress.org/trunk@51631 602fd350-edb4-49c9-b593-d223f7449a82