Commit Graph

19096 Commits

Author SHA1 Message Date
Sergey Biryukov
d7c22d29cf Code Modernization: Check the input type in validate_file().
This fixes a `preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated` notice on PHP 8.1.

The behavior for `null` and `string` input is covered by the existing `Tests_Functions::test_validate_file()` test.

Effect: Errors down by 238, assertions up by 1920, failures down by 1.

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51625 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-16 22:51:47 +00:00
Sergey Biryukov
d93f76dca8 Code Modernization: Correct handling of null in wp_parse_str().
This fixes `parse_str(): Passing null to parameter #1 ($string) of type string is deprecated` notices on PHP 8.1, without change in behaviour.

Impact: 311 of the pre-existing tests are affected by this issue.

The PHP native `parse_str()` function expects a string, however, based on the failing tests, it is clear there are functions in WordPress which passes a non-string – including `null` – value to the `wp_parse_str()` function, which would subsequently pass it onto the PHP native function without further input validation.

Most notable offender is the `wp_parse_args()` function which special cases arrays and objects, but passes everything else off to `wp_parse_str()`.

Several ways to fix this issue have been explored, including checking the received value with `is_string()` or `is_scalar()` before passing it off to the PHP native `parse_str()` function.

In the end it was decided against these in favor of a string cast as:
* `is_string()` would significantly change the behavior for anything non-string.
* `is_scalar()` up to a point as well, as it does not take objects with a `__toString()` method into account.

Executing a string cast on the received value before passing it on maintains the pre-existing behavior while still preventing the deprecation notice coming from PHP 8.1.

Reference: [https://www.php.net/manual/en/function.parse-str.php PHP Manual: parse_str()]

Follow-up to [5709].

Props jrf, hellofromTonya, lucatume, SergeyBiryukov.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51624 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-16 22:16:32 +00:00
Sergey Biryukov
18bda14e1e Code Modernization: Check the return type of parse_url() in WP::parse_request().
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]

In this case, `parse_url()` is called with the `PHP_URL_PATH` as `$component`. This will return `null` in the majority of cases, as – exсept for subdirectory-based sites – `home_url()` returns a URL without the trailing slash, like `http://example.org`.

The return value of `parse_url()` was subsequently passed to `trim()`, leading to a `trim(): Passing null to parameter #1 ($string) of type string is deprecated` notice on PHP 8.1.

Fixed by adjusting the logic flow to:
* Only pass the return value of `parse_url()` to follow-on functions if it makes sense, i.e. if it isn't `null`, nor an empty string.
* Preventing calls to `preg_replace()` and `trim()` further down in the function logic flow, when `preg_replace()`/`trim()` would have nothing to do anyhow.

Follow-up to [25617].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51622 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-16 20:16:13 +00:00
Sergey Biryukov
c9df4f75a2 Code Modernization: Check the return type of _get_cron_array() in wp_schedule_event().
This fixes a "Deprecated: Automatic conversion of false to array is deprecated" warning on PHP 8.1.

In `wp_schedule_event()`, 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 `wp_schedule_event()` function just blindly continues by assigning a value to a subkey of the `$crons` "array".

Fixed by adding validation for the returned value from `_get_cron_array()` and initializing an empty array if `false` was returned.

Reference: [https://developer.wordpress.org/reference/functions/_get_cron_array/ WordPress Developer Resources: _get_cron_array()]

Props jrf, hellofromTonya, lucatume, pbearne, iluy, pedromendonca, SergeyBiryukov.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51619 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-16 15:22:38 +00:00
Sergey Biryukov
8905ffc319 Twenty Twenty: Add support for wa.me links in Social menu.
This ensures that `wa.me` links, currently preferred by WhatsApp, have the same icon as `whatsapp.com` links.

Follow-up to [47243], [51617].

Props sabernhardt, macmanx.
Fixes #50542.

git-svn-id: https://develop.svn.wordpress.org/trunk@51618 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-16 12:53:53 +00:00
Sergey Biryukov
a2e76e2574 Twenty Seventeen: Add support for wa.me links in Social Links menu.
This ensures that `wa.me` links, currently preferred by WhatsApp, have the same icon as `whatsapp.com` links.

Follow-up to [48027].

Props sabernhardt, carepsules, dkarfa.
Fixes #51946.

git-svn-id: https://develop.svn.wordpress.org/trunk@51617 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-16 12:49:32 +00:00
Sergey Biryukov
710f30eb96 Docs: Fix typo in the get_block_editor_settings() description.
Follow-up to [50776].

Props tmatsuur, pbearne.
Fixes #53922.

git-svn-id: https://develop.svn.wordpress.org/trunk@51611 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-15 12:44:26 +00:00
Sergey Biryukov
fadb6b076e Upgrade/Install: Use consistent capitalization for "web host" in setup messages.
Follow-up to [8887], [13163].

Props bradparbs, sabernhardt, mukesh27.
Fixes #53926.

git-svn-id: https://develop.svn.wordpress.org/trunk@51610 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-14 12:05:25 +00:00
Sergey Biryukov
d16e03f2fe Docs: Correct @since version for the wp_parse_str filter.
The filter was introduced along with the `wp_parse_str()` function in WordPress 2.2.1.

Follow-up to [5709], [8662], [26485].

See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@51609 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-13 15:49:10 +00:00
Sergey Biryukov
eb6b517aec Docs: Synchronize documentation for wp_get_attachment_image_attributes filter callbacks in bundled themes:
* Twenty Sixteen: Correct the `$attachment` parameter type, use typed array notation.
* Twenty Seventeen: Correct the `$attachment` parameter type, use typed array notation.
* Twenty Nineteen: Correct the `@return` value type, use typed array notation.
* Twenty Twenty-One: Add missing `@return` value description, use typed array notation.

Follow-up to [29836], [47249], [49021], [49597].

Props ankitmaru, mukesh27, SergeyBiryukov.
Fixes #53878.

git-svn-id: https://develop.svn.wordpress.org/trunk@51607 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-12 19:29:43 +00:00
Sergey Biryukov
27098883f9 Themes: Make sure the theme API response is not an error before operating on it in themes_api().
This fixes a potential bug and avoids PHP warnings when `themes_api( 'query_themes' )` is called and a successful API response is not received.

Follow-up to [42632].

Props pierlo.
Fixes #53913.

git-svn-id: https://develop.svn.wordpress.org/trunk@51601 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-11 13:00:46 +00:00
Greg Ziółkowski
d9599addd1 Blocks: Add support for variations in block.json` file
We integrated variations with block types and the corresponding REST API endpoint in #52688. It's a follow-up patch to add missing support to the `block.json` metadata file when using `register_block_type`.

Some fields for variations are translatable.Therefore, i18n schema was copied over from Gutenberg: https://github.com/WordPress/gutenberg/blob/trunk/packages/blocks/src/api/i18n-block.json. The accompanying implementation was adapted as `translate_settings_using_i18n_schema`.

Props: gwwar, swissspidy, schlessera, jorgefilipecosta.
Fixes #53238.



git-svn-id: https://develop.svn.wordpress.org/trunk@51599 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-11 09:06:31 +00:00
Sergey Biryukov
43b55b4509 General: Restore (un-deprecate) the sanitize_url() function.
A general security rule is "Sanitize when you save, escape when you echo", and for the most part WordPress has well-named functions like `sanitize_email()` and others, with `esc_url_raw()` being a single exception that does not follow the naming.

This commit restores the previously deprecated `sanitize_url()` function as a valid alias of `esc_url_raw()`.

This better aligns with the naming with other `sanitize_*()` functions:

* `sanitize_bookmark()`
* `sanitize_bookmark_field()`
* `sanitize_category()`
* `sanitize_category_field()`
* `sanitize_comment_cookies()`
* `sanitize_email()`
* `sanitize_file_name()`
* `sanitize_hex_color()`
* `sanitize_hex_color_no_hash()`
* `sanitize_html_class()`
* `sanitize_key()`
* `sanitize_meta()`
* `sanitize_mime_type()`
* `sanitize_option()`
* `sanitize_post()`
* `sanitize_post_field()`
* `sanitize_sql_orderby()`
* `sanitize_term()`
* `sanitize_term_field()`
* `sanitize_text_field()`
* `sanitize_textarea_field()`
* `sanitize_title()`
* `sanitize_title_for_query()`
* `sanitize_title_with_dashes()`
* `sanitize_trackback_urls()`
* `sanitize_user()`
* `sanitize_user_field()`

Follow-up to [11383], [13096].

Props Ipstenu, aadilali.
Fixes #53876.

git-svn-id: https://develop.svn.wordpress.org/trunk@51597 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-10 19:43:33 +00:00
Sergey Biryukov
c550a592b9 Editor: Preserve the original template keys when preparing a list of page templates.
Previously, the original "404" template key was lost when "Default template" is merged into the available templates array, as the `array_merge()` function renumbers numeric keys. Later, when we merge templates on the client side, this caused duplicate "404" templates to appear in the dropdown.

By replacing the `array_merge()` call with `array_replace()`, we make sure to keep the original numeric keys.

Props Mamaduka, Toro_Unit, youknowriad.
Fixes #53898.

git-svn-id: https://develop.svn.wordpress.org/trunk@51595 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-10 17:55:37 +00:00
Sergey Biryukov
016cce0695 Docs: Improve documentation for a few functions per the documentation standards.
This affects:
* `checked()`
* `selected()`
* `disabled()`
* `wp_readonly()`
* `readonly()`
* `__checked_selected_helper()`

Follow-up to [143], [560], [9053], [10662], [13658], [41728], [51586].

See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@51592 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-10 13:44:34 +00:00
Sergey Biryukov
88fb0bc5e0 Upgrade/Install: Update sodium_compat to v1.17.0.
The latest version of sodium_compat includes fixes for PHP 8.1 compatibility and a fix for PHP 5.6 compatibility.

A full list of changes in this update can be found on GitHub:
https://github.com/paragonie/sodium_compat/compare/v1.16.1...v1.17.0

Follow-up to [49741], [51002].

Props jrf.
Fixes #53907.

git-svn-id: https://develop.svn.wordpress.org/trunk@51591 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-10 13:03:41 +00:00
Sergey Biryukov
26302004ba Docs: Add a @see reference to the xmlrpc_enabled filter in wp_xmlrpc_server::set_is_enabled().
Follow-up to [28065].

See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@51590 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-10 12:52:48 +00:00
Sergey Biryukov
1c76a1652d Docs: Add a @see reference to the wp_mail_content_type filter in wp_staticize_emoji_for_email().
Follow-up to [31860].

See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@51589 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-10 12:52:15 +00:00
Sergey Biryukov
fff4242f1a Code Modernization: Rename the readonly() function to wp_readonly().
Since PHP 8.1, `readonly` is a reserved keyword and cannot be used as a function name.

In order to avoid PHP parser errors, the `readonly()` function was extracted to a separate file and is now only included conditionally on PHP < 8.1.

This commit also:
* Moves the tests for the `__checked_selected_helper()` function and all the related functions to their own file.
* Switches to named data providers. This makes the output when using the `--testdox` option more descriptive and is helpful when trying to debug which data set from a data provider failed the test.
* Improves the tests in question to make them feature-complete and expand test coverage.

Props jrf, ayeshrajans, haosun, knutsp, swissspidy, SergeyBiryukov.
Fixes #53858.

git-svn-id: https://develop.svn.wordpress.org/trunk@51586 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-09 17:19:21 +00:00
Sergey Biryukov
25bc89f44a Code Modernization: Set the MySQLi error reporting off for PHP 8.1.
Prior to PHP 8.1, the default error handling mode was `MYSQLI_REPORT_OFF`. An error in the extension, database, query, or the database connection returned `false` and emitted a PHP warning:
{{{
$mysqli = new mysqli("localhost", "non-existing-user", "", "");

Warning: mysqli::__construct(): (HY000/2002): No connection could be made because the target machine actively refused it in ... on line ...
}}}

From PHP 8.1 and later, the default error mode is set to `MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT`. An error in the extension, database, query, or the database connection throws an exception:
{{{
$mysqli = new mysqli("localhost", "non-existing-user", "", "");

Fatal error: Uncaught mysqli_sql_exception: Connection refused in ...:...
}}}

WordPress has its own error reporting and gracefully handles the database errors by inspecting the error codes. Setting the MySQLi error reporting to off avoids fatal errors due to uncaught exceptions and maintains the current behavior.

References:
* [https://php.watch/versions/8.1/mysqli-error-mode PHP 8.1: MySQLi: Default error mode set to exceptions]
* [https://wiki.php.net/rfc/mysqli_default_errmode PHP RFC: Change Default mysqli Error Mode]

Props ayeshrajans, jrf.
Fixes #52825.

git-svn-id: https://develop.svn.wordpress.org/trunk@51582 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-08 14:08:15 +00:00
John Blackbourn
05923f05d3 Themes: Correct the documented types for theme mod values.
A theme mod value can be of any type, not just a string.

See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51578 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-07 13:53:58 +00:00
Sergey Biryukov
16848d5468 Coding Standards: Silence a WPCS warning in date_i18n().
This fixes a "Calling `current_time()` with a `$type` of `timestamp` or `U` is strongly discouraged as it will not return a Unix (UTC) timestamp" warning.

Props jrf.
See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51557 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 14:48:11 +00:00
Sergey Biryukov
a6bb6ef2fc Twenty Thirteen: Correct indentation in image.php template.
Props jrf.
See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51556 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 14:37:27 +00:00
Sergey Biryukov
87da9620ad Twenty Thirteen: Remove wrapping HTML tag from translatable string.
This fixes a "Strings should not be wrapped in HTML" WPCS warning.

Props jrf.
See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51554 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 14:35:09 +00:00
Sergey Biryukov
f52ef12091 Bundled Themes: Remove redundant semicolons after closing curly brackets.
Includes a few minor indentation fixes.

Props jrf.
See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51553 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 13:24:57 +00:00
Sergey Biryukov
2bfd2c5da9 Coding Standards: Remove redundant semicolons after closing curly brackets.
Props jrf.
See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51552 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 13:14:21 +00:00
Sergey Biryukov
b2be104b9d Coding Standards: Fix incorrect alignment in two comment blocks.
Tabs should only be used for indentation and not for mid-line alignment.

Props jrf.
See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51551 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 13:10:05 +00:00
Sergey Biryukov
efe00618ab Coding Standards: Fix incorrect comment indent in safecss_filter_attr().
Props jrf.
See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51550 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 12:58:45 +00:00
Peter Wilson
3ebaa9220f Coding Standards: Use strict comparisons in wp-admin/upload.php.
See #53359.


git-svn-id: https://develop.svn.wordpress.org/trunk@51549 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 03:36:24 +00:00
Peter Wilson
e776002eaf Coding Standards: Use strict comparisons in wp-admin/options-discussion.php.
See #53359.


git-svn-id: https://develop.svn.wordpress.org/trunk@51548 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-05 03:29:53 +00:00
Sergey Biryukov
a52d8cdfc2 Media: Add / character to <img> tag in wp_print_media_templates().
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.

Follow-up to [47493], [48834], [50556], [51473], [51541].

Props shital-patel, akabarikalpesh.
Fixes #53870.

git-svn-id: https://develop.svn.wordpress.org/trunk@51542 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-04 14:23:18 +00:00
Sergey Biryukov
2ed4b82cb0 Bundled Themes: Add / character to <img> tags.
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.

Follow-up to [47493], [48834], [50556], [51473].

Props shital-patel, akabarikalpesh.
See #53870.

git-svn-id: https://develop.svn.wordpress.org/trunk@51541 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-04 14:22:37 +00:00
Peter Wilson
601ae4a6b2 Editor: Prevent block-editor JavaScript loading in other editors.
Add a check to `wp_add_iframed_editor_assets_html()` confirming the edit post screen is using the block-editor before including block-editor specific JavaScript. For the classic and other editors the function returns early without any output.

Props swissspidy, desrosj.
Fixes #53696.



git-svn-id: https://develop.svn.wordpress.org/trunk@51540 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-04 05:09:08 +00:00
Peter Wilson
bed17098b8 Menus: Hide bulk-select on new menu page.
Prevent the bulk-select option from displaying when adding a new menu. This also prevents the option from displaying when an administrator first visits the menu page and no menus are set.

Props dlh, sabernhardt.
Fixes #53654.



git-svn-id: https://develop.svn.wordpress.org/trunk@51539 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-04 04:59:46 +00:00
Jorge Costa
5951c60aed Block Editor: Add missing border setting on button block.
This commit fixes a regression on WordPress 5.8 that made the border radius setting on the buttons block disappear.

Props Mamaduka, daisyo, priethor, desrosj, mikeschroder.
Fixes #53702.

git-svn-id: https://develop.svn.wordpress.org/trunk@51538 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 18:13:46 +00:00
Jonathan Desrosiers
3148181925 Build/Test Tools: Revert changes only included for testing purposes.
Follow up to [51535-51536].

See #52644.

git-svn-id: https://develop.svn.wordpress.org/trunk@51537 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 15:14:03 +00:00
Jonathan Desrosiers
ce0396ba76 Build/Test Tools: Expand Slack notifications for GitHub Actions.
This expands Slack notifications to include success, cancelled, and “fixed” GitHub Action workflow run outcomes in addition to failures.

A “fixed” outcome occurs when the previous run for a workflow failed and the current one succeeds. This matches the behavior that was native to TravisCI by setting `on_success` for notifications to `change`.

The message details and where each outcome is posted is controlled by Slack workflows.

The Slack notification logic has also been pulled into a separate workflow to prevent repeating code in every workflow.

See #52644.

git-svn-id: https://develop.svn.wordpress.org/trunk@51535 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 13:45:02 +00:00
Sergey Biryukov
f117c74c6a Coding Standards: Correct DateTimeZone class name in WP_Customize_Date_Time_Control::get_timezone_info().
Follow-up to [41626].

See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51534 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 12:17:54 +00:00
Sergey Biryukov
a5de731f9e Code Modernization: Pass correct default value to new DateTime() in wp_default_packages_inline_scripts().
This fixes a "Deprecated: `DateTime::__construct()`: Passing null to parameter #1 (`$datetime`) of type string is deprecated" warning on PHP 8.1.

Follow-up to [49083].

See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51533 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 12:03:41 +00:00
Sergey Biryukov
9f3c2be1d0 Code Modernization: Silence the deprecation warnings for missing return type in WP_Block_List.
This fixes the "Deprecated: Return type of `WP_Block_List::[METHODNAME]()` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517], [51529], [51530], [51531].

Props jrf.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51532 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 11:11:45 +00:00
Sergey Biryukov
289c9c7248 Code Modernization: Silence the deprecation warnings for missing return type in WP_REST_Request.
This fixes the "Deprecated: Return type of `WP_REST_Request::[METHODNAME]($offset)` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517], [51529], [51530].

Props jrf.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51531 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 11:07:28 +00:00
Sergey Biryukov
471edb0193 Code Modernization: Silence the deprecation warnings for missing return type in WP_Hook.
This fixes the "Deprecated: Return type of `WP_Hook::[METHODNAME]()` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517], [51529].

Props jrf.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51530 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-03 11:00:50 +00:00
Sergey Biryukov
df724f991b Code Modernization: Silence the deprecation warnings for missing return type in WP_Theme.
This fixes the "Deprecated: Return type of `WP_Theme::[METHODNAME]($offset)` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517].

Props jrf.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51529 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-02 22:30:04 +00:00
Sergey Biryukov
717158ee32 Upgrade/Install: Store correct result when bulk updating plugins or themes.
This ensures that when multiple plugins or themes are updated and one succeeds and another fails, the error is reported accordingly.

Previously, both updates would end up treated as a success, due to `$this->result` containing the result of the previous operation and not the current one.

Follow-up to [12097].

Props pwtyler, afragen.
Fixes #53002.

git-svn-id: https://develop.svn.wordpress.org/trunk@51528 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-02 20:54:44 +00:00
Sergey Biryukov
80ccb3697c Docs: Fix typo in the WP_Upgrader::install_package() description.
Follow-up to [30758].

See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@51527 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-02 18:26:34 +00:00
Sergey Biryukov
1ea9ce390d Coding Standards: Fix typo in the JS function name for handling the password reset button.
Follow-up to [50129].

See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51526 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-02 16:47:38 +00:00
Sergey Biryukov
3a189c93e1 Upgrade/Install: Avoid creating nonce during installation.
This avoids a "Table `wp_options` doesn't exist" database error when trying to create a nonce for password reset button.

When installing and using database-saved salts, `wp_create_nonce()` causes database errors as `wp_salt()` attempts to insert into the not-yet-created options table. Since authentication is not available during installation, we can safely skip creating a nonce.

Follow-up to [39684], [50129].

Props schlessera, swissspidy, sanketchodavadiya, hellofromTonya, SergeyBiryukov.
Fixes #53830.

git-svn-id: https://develop.svn.wordpress.org/trunk@51525 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-02 16:37:57 +00:00
Sergey Biryukov
2ba4a4817a Themes: Make sure get_theme_mods() always returns an array.
This avoids a "Cannot access offset of type string on string" fatal error in `set_theme_mod()` on PHP 8 if the `theme_mods_$theme_slug` option has an incorrect value, e.g. an empty string instead of an array.

With this change, `set_theme_mod()` should be able to resolve the issue by saving a correct value.

Follow-up to [15736], [15739], [30672], [32629], [32632].

Props xknown.
See #51423.

git-svn-id: https://develop.svn.wordpress.org/trunk@51524 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-01 14:54:52 +00:00
Sergey Biryukov
ac47170bb5 Docs: Document the $wpdb global in WP_Debug_Data::get_mysql_var().
Follow-up to [51522].

See #53845.

git-svn-id: https://develop.svn.wordpress.org/trunk@51523 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-01 14:03:09 +00:00
Sergey Biryukov
495f4f7641 Site Health: Add some more MySQL information to the Site Health Info screen.
This adds three values to the debug info in the Database section:

* Max allowed packet size
* Max connections number
* Query cache size

Props zodiac1978, donmhico, mukesh27, SergeyBiryukov.
Fixes #53845.

git-svn-id: https://develop.svn.wordpress.org/trunk@51522 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-01 14:00:17 +00:00