Commit Graph

44380 Commits

Author SHA1 Message Date
Sergey Biryukov
42c7a1fad5 Coding Standards: Fix WPCS issue in [51682].
This fixes a "Misleading line break before `'||'`; readers may interpret this as an expression boundary" error.

See #54030.
Built from https://develop.svn.wordpress.org/trunk@51683


git-svn-id: http://core.svn.wordpress.org/trunk@51289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-28 01:34:56 +00:00
Sergey Biryukov
79b0d3f3e8 Customize: Prevent collapsing expanded panel/section/control when Esc is pressed on a block editor instance.
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.
Built from https://develop.svn.wordpress.org/trunk@51682


git-svn-id: http://core.svn.wordpress.org/trunk@51288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-28 01:25:59 +00:00
desrosj
ed0e054f34 Build/Test Tools: Preserve text within backticks in Slack notifications.
Props SergeyBiryukov, johnbillion, earnjam.
See #52644.
Built from https://develop.svn.wordpress.org/trunk@51679


git-svn-id: http://core.svn.wordpress.org/trunk@51285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-27 17:35:58 +00:00
Sergey Biryukov
0ae0fbedce Plugins: Display a message on Plugins list table if a plugin requires a higher version of PHP or WordPress.
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.
Built from https://develop.svn.wordpress.org/trunk@51678


git-svn-id: http://core.svn.wordpress.org/trunk@51284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-27 15:43:57 +00:00
Mike Schroder
9aeacc728a Customizer: Respect prefers-reduced-motion media query in Customizer animations.
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.
Built from https://develop.svn.wordpress.org/trunk@51677


git-svn-id: http://core.svn.wordpress.org/trunk@51283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-27 09:36:57 +00:00
John Blackbourn
b3226d8e62 REST API: Correct the description for the last_updated property in the block-directory endpoint.
This field shows the date in ISO 8601 format.

Fixes #53595

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


git-svn-id: http://core.svn.wordpress.org/trunk@51282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 19:34:56 +00:00
John Blackbourn
52d6bd3529 Security: Correct the inline docs for the wp_kses_allowed_html filter.
Props peterwilsoncc

Fixes #53597

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


git-svn-id: http://core.svn.wordpress.org/trunk@51281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 19:28:57 +00:00
desrosj
9bc8352b00 Editor: Ensure block attribute serialization in PHP matches the JavaScript equivalent.
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.
Built from https://develop.svn.wordpress.org/trunk@51674


git-svn-id: http://core.svn.wordpress.org/trunk@51280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 19:10:58 +00:00
desrosj
b6f34e7b44 Build/Test Tools: Use list format when defining environment variables in Docker compose file.
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.
Built from https://develop.svn.wordpress.org/trunk@51673


git-svn-id: http://core.svn.wordpress.org/trunk@51279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 18:41:58 +00:00
ryelle
e32d9ec522 Toolbar: Provide a CSS custom property for the admin bar height.
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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 18:24:58 +00:00
desrosj
2ddca7fd4a Build/Test Tools: Remove shell: bash from code coverage workflow.
bash is the default shell for all non-Windows GitHub Action runners, so this is not necessary.

Follow up to [51670].
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51671


git-svn-id: http://core.svn.wordpress.org/trunk@51277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 18:22:57 +00:00
desrosj
59faf7aeb6 Build/Test Tools: Remove shell: bash from PHPUnit test workflow.
bash is the default shell for all non-Windows GitHub Action runners, so this is not necessary.

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51670


git-svn-id: http://core.svn.wordpress.org/trunk@51276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 18:21:58 +00:00
hellofromTonya
31def8058e Tests: Improve bootstrap error message for when ABSPATH folder does not exist.
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.
Built from https://develop.svn.wordpress.org/trunk@51669


git-svn-id: http://core.svn.wordpress.org/trunk@51275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 17:56:57 +00:00
Sergey Biryukov
1f7f8fb16a Coding Standards: Add missing visibility keywords for wp_filter_object_list() and wp_list_pluck() tests.
Follow-up to [51663-51667].

Props pbearne.
See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51668


git-svn-id: http://core.svn.wordpress.org/trunk@51274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:51:57 +00:00
Sergey Biryukov
4810f47fd5 Tests: Move wp_list_sort() tests to their own file.
This matches the name of the function being tested.

Follow-up to [38928], [51663-51666].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51667


git-svn-id: http://core.svn.wordpress.org/trunk@51273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:30:56 +00:00
Sergey Biryukov
48aa9e7147 Tests: Move wp_list_filter() tests to their own file.
This matches the name of the function being tested.

Follow-up to [38928], [51663-51665].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51666


git-svn-id: http://core.svn.wordpress.org/trunk@51272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:21:58 +00:00
Sergey Biryukov
5cfd90b427 Tests: Rename the test file and class for wp_filter_object_list() tests.
This matches the name of the function being tested.

Follow-up to [410/tests], [51663], [51664].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51665


git-svn-id: http://core.svn.wordpress.org/trunk@51271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:09:56 +00:00
Sergey Biryukov
18ef0d4252 Tests: Remove duplicate wp_list_pluck() tests.
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.
Built from https://develop.svn.wordpress.org/trunk@51664


git-svn-id: http://core.svn.wordpress.org/trunk@51270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 16:03:57 +00:00
Sergey Biryukov
a9cff26ae7 Tests: Move wp_list_pluck() tests to their own file.
The tests were partially duplicated in two separate files.

Follow-up to [431/tests], [28900], [38928], [42527].

See #53363, #53987.
Built from https://develop.svn.wordpress.org/trunk@51663


git-svn-id: http://core.svn.wordpress.org/trunk@51269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 15:55:57 +00:00
hellofromTonya
ab252fb910 Coding Standards: Fix indentation and remove ignore annotation in wp_privacy_send_personal_data_export_email().
Follow-up to [51129], [51410].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51662


git-svn-id: http://core.svn.wordpress.org/trunk@51268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 14:05:58 +00:00
hellofromTonya
2e9fe3c986 Coding Standards: Make ignore annotation more specific in WP_Site_Health_Auto_Updates::test_vcs_abspath().
Follow-up to [44986].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51661


git-svn-id: http://core.svn.wordpress.org/trunk@51267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:59:59 +00:00
hellofromTonya
a91fc400a0 Coding Standards: Remove redundant ignore annotation in populate_options().
Follow-up to [43627], [43628].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51660


git-svn-id: http://core.svn.wordpress.org/trunk@51266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:50:59 +00:00
hellofromTonya
90a950783d Coding Standards: Update the config for WordPress.PHP.FileName in PHPCS ruleset.
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.
Built from https://develop.svn.wordpress.org/trunk@51659


git-svn-id: http://core.svn.wordpress.org/trunk@51265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:36:56 +00:00
hellofromTonya
958cd3a964 Coding Standards: Update the config for WordPress.PHP.NoSilencedErrors in PHPCS ruleset.
Follow-up to [45611].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51658


git-svn-id: http://core.svn.wordpress.org/trunk@51264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:20:56 +00:00
hellofromTonya
c7d3e267b8 Coding Standards: Use static closures when not using $this.
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.
Built from https://develop.svn.wordpress.org/trunk@51657


git-svn-id: http://core.svn.wordpress.org/trunk@51263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 12:59:02 +00:00
Sergey Biryukov
622985b69c Docs: Add missing @since tag for the $check_signatures parameter of WP_Upgrader::run().
This matches the `WP_Upgrader::download_package()` documentation more closely.

Follow-up to [44954], [45262].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51655


git-svn-id: http://core.svn.wordpress.org/trunk@51261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-25 14:39:59 +00:00
Sergey Biryukov
d529999e5b Docs: Clarify a comment in WP_Upgrader::run().
This matches the `WP_Upgrader::download_package()` documentation more closely.

Follow-up to [11005], [30758], [33685].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51654


git-svn-id: http://core.svn.wordpress.org/trunk@51260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-24 23:10:06 +00:00
Andrew Ozz
94a990de99 Media: Fix wp_unique_filename() to check for name collisions with all alternate file names when an image may be converted after uploading. This includes possible collinions with pre-existing images whose sub-sizes/thumbnails are regenerated.
Props ianmjones, azaozz.
Fixes #53668.
Built from https://develop.svn.wordpress.org/trunk@51653


git-svn-id: http://core.svn.wordpress.org/trunk@51259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-24 20:52:03 +00:00
Sergey Biryukov
e53ffbaf95 Code Modernization: Pass correct default value to http_build_query() in WP_Sitemaps_Provider::get_sitemap_url().
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.
Built from https://develop.svn.wordpress.org/trunk@51652


git-svn-id: http://core.svn.wordpress.org/trunk@51258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-23 11:44:01 +00:00
Sergey Biryukov
cdf31027d6 Tests: Rename classes in phpunit/tests/feed/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51651


git-svn-id: http://core.svn.wordpress.org/trunk@51257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-22 10:08:59 +00:00
Sergey Biryukov
eec183cb63 Tests: Rename classes in phpunit/tests/error-protection/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51650


git-svn-id: http://core.svn.wordpress.org/trunk@51256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-21 15:34:01 +00:00
Andrew Ozz
774c8047c5 Editor: Replace the remaining references to wp.editor with wp.oldEditor.
Props zieladam.
Fixes #53762.
Built from https://develop.svn.wordpress.org/trunk@51649


git-svn-id: http://core.svn.wordpress.org/trunk@51255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-21 00:20:00 +00:00
Andrew Ozz
7fc3aae637 REST API: Remove trailing slashes when preloading requests and add unit tests for it.
Props antonvlasenko.
Fixes #51636.
Built from https://develop.svn.wordpress.org/trunk@51648


git-svn-id: http://core.svn.wordpress.org/trunk@51254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-20 23:44:57 +00:00
desrosj
f514f51180 Build/Test Tools: Include the commit short summary in Slack messages.
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.
Built from https://develop.svn.wordpress.org/trunk@51647


git-svn-id: http://core.svn.wordpress.org/trunk@51253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-20 19:00:00 +00:00
Sergey Biryukov
1be5d3e997 Tests: Rename classes in phpunit/tests/editor/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51646


git-svn-id: http://core.svn.wordpress.org/trunk@51252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-20 16:13:04 +00:00
ryelle
899e4635de Privacy: Add space below page selector.
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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 20:58:57 +00:00
ryelle
9d2e8c096f Toolbar: Limit the icon transition style to color only.
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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 17:24:55 +00:00
Sergey Biryukov
87bd00ac5b Tests: Move loading the WP_Community_Events class to set_up_before_class().
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.
Built from https://develop.svn.wordpress.org/trunk@51641


git-svn-id: http://core.svn.wordpress.org/trunk@51247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 14:00:57 +00:00
Sergey Biryukov
590f56db3b Tests: Rename classes in phpunit/tests/admin/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51639


git-svn-id: http://core.svn.wordpress.org/trunk@51245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 13:09:57 +00:00
Sergey Biryukov
ccbd16fef1 Media: Check the return type of _get_cron_array() in WP_Media_List_Table::prepare_items().
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.
Built from https://develop.svn.wordpress.org/trunk@51638


git-svn-id: http://core.svn.wordpress.org/trunk@51244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 12:44:57 +00:00
Peter Wilson
cda7c787e8 Customize: Hide native control on background position field.
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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 02:07:56 +00:00
Sergey Biryukov
27522c6f67 Code Modernization: Silence the deprecation warning for auto_detect_line_endings.
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.
Built from https://develop.svn.wordpress.org/trunk@51636


git-svn-id: http://core.svn.wordpress.org/trunk@51242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 21:58:57 +00:00
Sergey Biryukov
74b515c1ba External Libraries: Restore the phpcs:ignore statements in PHPMailer.
These are necessary for a passing PHP Compatibility scan.

Follow-up to [48045], [51634].

See #53953.
Built from https://develop.svn.wordpress.org/trunk@51635


git-svn-id: http://core.svn.wordpress.org/trunk@51241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 14:08:56 +00:00
Sergey Biryukov
fd5aea9246 External Libraries: Upgrade PHPMailer to version 6.5.1.
The latest release includes preliminary PHP 8.1 support, as well as some small bug fixes.

Release notes: https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.1

For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.5.0...v6.5.1

Follow-up to [50628], [50799], [51169].

Props jrf.
Fixes #53953.
Built from https://develop.svn.wordpress.org/trunk@51634


git-svn-id: http://core.svn.wordpress.org/trunk@51240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 13:53:58 +00:00
Sergey Biryukov
0a2c7dc86c Code Modernization: Only set auto_detect_line_endings in PHP < 8.1.
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.
Built from https://develop.svn.wordpress.org/trunk@51633


git-svn-id: http://core.svn.wordpress.org/trunk@51239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 13:23:56 +00:00
Peter Wilson
43e86e620a Media: Increase number of media items displayed per page.
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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 06:00:59 +00:00
Peter Wilson
c9bf6d13ef Media: Fix layout of media library modal on narrow screens.
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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-18 05:37:57 +00:00
Sergey Biryukov
80548a4039 Code Modernization: Check the return type of parse_url() in ms_cookie_constants().
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

It is entirely possible for the `siteurl` option to not have a "path" component.

In PHP 8.1, this would lead to a `trim(): Passing null to parameter #1 ($string) of type string is deprecated` notice.

Changing the logic around and adding validation for the return type value of `parse_url()` prevents that.

As this function is declaring global constants, adding tests for this change is not really an option without potentially affecting other tests.

Follow-up to [51606], [51622], [51626], [51629].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51630


git-svn-id: http://core.svn.wordpress.org/trunk@51236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 22:08:57 +00:00
Sergey Biryukov
1ee5e68a94 Code Modernization: Check the return type of parse_url() on Plugin/Theme Editor screens.
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

While it is probably unlikely that someone would have a direct link to the plugin/theme editor on their home page or even on someone else's homepage, it is entirely possible for the referrer URL to not have a "path" component.

In PHP 8.1, this would lead to a `basename(): Passing null to parameter #1 ($string) of type string is deprecated` notice.

Changing the logic around and adding validation for the return type value of `parse_url()` prevents that.

Follow-up to [51606], [51622], [51626].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51629


git-svn-id: http://core.svn.wordpress.org/trunk@51235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 21:56:58 +00:00
Sergey Biryukov
28e10d9c17 Tests: Move loading the PO class to set_up_before_class().
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 [1106/tests].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@51628


git-svn-id: http://core.svn.wordpress.org/trunk@51234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 20:03:00 +00:00