The [https://make.wordpress.org/core/2021/02/19/feature-plugin-rollback-update-failure/ Rollback Update Failure feature project] has been split into two plugins for testing:
* [https://github.com/afragen/faster-updates Faster Updates] speeds up plugin or theme updates by moving files rather than copying them, thus decreasing the memory usage and reducing the chance of timeouts or running out of disk space during updates.
* [https://wordpress.org/plugins/rollback-update-failure/ Rollback Update Failure] creates a temporary backup of plugins and themes before updating. This aims to make the update process more reliable and ensure that if a plugin or theme update fails, the previous version can be safely restored.
The current priority of the feature project is to test the new `move_dir()` function, which offers better performance than `copy_dir()`. Instead of copying a directory in a recursive manner file by file from one location to another, `move_dir()` uses the `rename()` PHP function to speed up the process, which is instrumental in updating large plugins without a delay. If the renaming failed, it falls back to the `copy_dir()` WP function.
The `move_dir()` function is self-contained in the Faster Updates plugin and does not require any special hooks in core, so the conditional previously added to `WP_Upgrader::install_package()` to facilitate testing is no longer needed and can be removed.
Follow-up to [53578], [54484], [54643].
Props afragen, costdev, peterwilsoncc.
See #56057, #57375, #57386.
Built from https://develop.svn.wordpress.org/trunk@55055
git-svn-id: http://core.svn.wordpress.org/trunk@54588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset moves typecasting to affect the `get_option` value, which ensures that when math is done it does not generate any error. In PHP 7.4 and earlier the previous implementation was dismissed as a warning, but in PHP 8+ it would have throw a fatal error.
Follow-up to [45856].
Props Nick_theGeek, SergeyBiryukov, johnbillion.
Fixes#57035.
Built from https://develop.svn.wordpress.org/trunk@55054
git-svn-id: http://core.svn.wordpress.org/trunk@54587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset indirectly improves performance of the commonly used `esc_url()` function by optimizing the low-level function `wp_kses_bad_protocol()` for the by far most common scenarios, which are URLs using either the `http` or `https` protocol.
For this common scenario, the changeset now avoids the `do while` loop. While for a single call to the `esc_url()` function the performance wins are negligible, given that `esc_url()` is often called many times in one page load, they can add up, making this a worthwhile improvement.
Props mukesh27, schlessera, markjaquith, azaozz, spacedmonkey.
Fixes#22951.
Built from https://develop.svn.wordpress.org/trunk@55053
git-svn-id: http://core.svn.wordpress.org/trunk@54586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$type` and `$object` parameters to `$object_type` and `$object_name` in `Test_WP_Customize_Nav_Menus::filter_items()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55049
git-svn-id: http://core.svn.wordpress.org/trunk@54582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Initializing the `WP_Locale` array properties to an empty array at the class definition point. Why?
* Ensure the properties initialize to an `array` data type at instantiation (rather than `null`).
This initialization is needed to ensure the properties are not `null` if another class inherits from `WP_Locale` but does not run `WP_Locale::init()` from the constructor. In this case, the initialization prevents
{{{
Warning: array_values() expects parameter 1 to be array, null given
}}}
when Core uses any of the properties.
* Good design practice.
The code and documentation are clearly expecting these properties to be an `array` data type. Setting each to a default `array()` state further helps to clearly communicate the code design.
Follow-up to [37889], [36292], [31078], [3676], [6589].
Props tyxla, SergeyBiryukov, azaozz, hellofromTonya, mukesh27.
See #57427.
Built from https://develop.svn.wordpress.org/trunk@55047
git-svn-id: http://core.svn.wordpress.org/trunk@54580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Renaming the class was missed in [54997] when updating changes in `WP_Http::request()` for the Requests 2.0.0 external library upgrade. The `HTTP` class no longer exists and caused a fatal error:
{{{
PHP Fatal error: Class 'WpOrg\Requests\Proxy\HTTP' not found in wp-includes/class-wp-http.php on line 382
}}}
This commit renames the class to `Http` and resolves the fatal error.
Follow-up to [52244], [52315], [52327], [52328], [54997], [55007].
Props danielbachhuber, jrf.
See #54504.
Built from https://develop.svn.wordpress.org/trunk@55046
git-svn-id: http://core.svn.wordpress.org/trunk@54579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds an anchor in Comments keyboard shortcut documentation links to direct the user to a more specific section of the HelpHub documentation. It also removes `target="_blank" from a link, since preventing data loss when clicking any on User Edit and Comment Edit screens is already handled by another existing ticket (#40493).
Props NekoJonez, SergeyBiryukov, sabernhardt, dennisatyoast, robinwpdeveloper.
Fixes#56920.
Built from https://develop.svn.wordpress.org/trunk@55042
git-svn-id: http://core.svn.wordpress.org/trunk@54575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset removes two unwanted semicolons from the gradients declaration in `aubergine.json`, fixing two gradients that were showing a checkerboard pattern instead of the gradient, and a console error for each of them.
Props wildworks, sabernhardt.
Fixes#57245.
Built from https://develop.svn.wordpress.org/trunk@55041
git-svn-id: http://core.svn.wordpress.org/trunk@54574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset removes a mention of the "Page" post type from the Discussion meta box as this is a generic meta box, used for multiple post types. It makes it more consistent with the other option available in the meta box ("Allow comments") and also with the corresponding option in the block editor.
Follow-up to [12323].
Props jeremyfelt, sabernhardt, audrasjb, virgar.
Fixes#57429.
See #11346.
Built from https://develop.svn.wordpress.org/trunk@55040
git-svn-id: http://core.svn.wordpress.org/trunk@54573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$class` parameter to `$setting_class` in:
* `Tests_WP_Customize_Manager::return_dynamic_customize_setting_class()`
* `Tests_WP_Customize_Manager::return_dynamic_customize_setting_args()`
* Amends the `$args` and `$id` parameters in both methods for consistency.
* Corrects the DocBlock for `::return_dynamic_customize_setting_args()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55039
git-svn-id: http://core.svn.wordpress.org/trunk@54572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$null` parameter to `$result` in `Tests_Cron::filter_pre_schedule_event_filter()`.
* Amends the `$pre` parameter of the `pre_schedule_event` filter for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55038
git-svn-id: http://core.svn.wordpress.org/trunk@54571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$string` parameter to `$input_string` in the unit tests for `mb_substr()` polyfill.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55037
git-svn-id: http://core.svn.wordpress.org/trunk@54570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$string` parameter to `$input_string` in the unit tests for `mb_strlen()` polyfill.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55036
git-svn-id: http://core.svn.wordpress.org/trunk@54569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$string` parameter to `$block_content` in `Tests_Block_Supports_Elements::make_unique_id_one()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55034
git-svn-id: http://core.svn.wordpress.org/trunk@54567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses a few errors along the lines of:
* Opening parenthesis of a multi-line function call must be the last content on the line
* Only one argument is allowed per line in a multi-line function call
* Each array item in a multi-line array declaration must end in a comma
* Closing parenthesis of a multi-line function call must be on a line by itself
Follow-up to [55030].
See #28407.
Built from https://develop.svn.wordpress.org/trunk@55032
git-svn-id: http://core.svn.wordpress.org/trunk@54565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previous to this change, attachment filenames in outgoing emails could only ever be derived from their paths (passed in as a numerically indexed array of `$attachments`).
This changeset adds support for passing an associative `$attachments` array, where the key strings will be used as filenames instead.
Includes 2 new unit tests to ensure both array formats continue to work as intended.
Props johnjamesjacoby, ritteshpatel, swissspidy, syntaxart.
Fixes#28407.
Built from https://develop.svn.wordpress.org/trunk@55030
git-svn-id: http://core.svn.wordpress.org/trunk@54563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Renaming the `$preempt` parameter to `$response` in the `pre_http_request` filter to better match the context used in callbacks (returning the original value if the conditions are not met rather than preempting the request).
* Synchronizing parameter names and types in various `pre_http_request` callbacks in unit tests.
Follow-up to [34509], [37907], [40628], [40629], [45667], [46175], [48242], [48462], [49904], [51021], [51973], [52146], [52382], [54043], [54968].
See #56793, #56792.
Built from https://develop.svn.wordpress.org/trunk@55029
git-svn-id: http://core.svn.wordpress.org/trunk@54562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$callable` parameter to `$callback` in `get_echo()`.
* Renames the `$array` parameter to `$expected_data` in `gen_tests_array()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55028
git-svn-id: http://core.svn.wordpress.org/trunk@54561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$namespace` parameter to `$route_namespace` in `Spy_REST_Server::register_route()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55027
git-svn-id: http://core.svn.wordpress.org/trunk@54560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds `required="required"` attributes to required form fields and uses `wp_required_field_message()` and `wp_required_field_indicator()` functions to improve the generated markup, and for better consistency with other required fields.
Props jackreichert, flixos90, afercia, sabernhardt.
Fixes#38460.
Built from https://develop.svn.wordpress.org/trunk@55026
git-svn-id: http://core.svn.wordpress.org/trunk@54559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit renames the `$tag` and `$function_to_add` parameters to match the `add_filter()` function signature.
Includes:
* Renaming the `$tag` parameter to `$hook_name`.
* Renaming the `$function_to_add` parameter to `$callback`.
* Synchronizing documentation for:
* `tests_add_filter()` and `add_filter()`
* `_test_filter_build_unique_id()` and `_wp_filter_build_unique_id()`
Follow-up to [760/tests], [38582], [43555], [46801], [50807], [52300], [53804], [53805], [55023].
See #56793.
Built from https://develop.svn.wordpress.org/trunk@55025
git-svn-id: http://core.svn.wordpress.org/trunk@54558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Update copyright year to 2023 in `license.txt` and bundled themes.
Follow-up to [18201], [23306], [28064], [36855], [36856], [39659], [40241], [42424], [46719], [46720], [47025], [47026], [49915], [52427].
Built from https://develop.svn.wordpress.org/trunk@55024
git-svn-id: http://core.svn.wordpress.org/trunk@54557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$function` parameter to `$callback` in `_test_filter_build_unique_id()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55023
git-svn-id: http://core.svn.wordpress.org/trunk@54556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a `public` visibility to a test where it was not explicitly specified. This continues the previous efforts to make sure visibility is declared on all methods.
Note: This will be enforced by WPCS 3.0.0.
Follow-up to [51919], [52009], [52010], [52338], [54889].
Props jrf.
See #56791.
Built from https://develop.svn.wordpress.org/trunk@55022
git-svn-id: http://core.svn.wordpress.org/trunk@54555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$parent` parameter to `$parent_post_id` in `WP_UnitTest_Factory_For_Attachment::create_upload_object()`.
* Amends the `$parent_post` parameter in `wp_insert_attachment()` and `WP_REST_Revisions_Controller::get_parent()` for consistency.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55021
git-svn-id: http://core.svn.wordpress.org/trunk@54554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$function` parameter to `$callback` in `WP_UnitTest_Factory_For_Thing::callback()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55020
git-svn-id: http://core.svn.wordpress.org/trunk@54553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In various unit test factory classes, some of the `create_object()` and `update_object()` methods returned a `WP_Error` object on failure, while a few others were documented to do so, but did not in practice, instead returning the value `0` or `false`, or not accounting for a failure at all.
This commit aims to handle this in a consistent way by updating the methods to always return the object ID on success and a `WP_Error` object on failure.
Includes:
* Updating and correcting the relevant documentation parts.
* Adding missing documentation and `@since` tags in some classes.
* Renaming some variables to clarify that it is the object ID which is passed around, not the object itself.
Follow-up to [760/tests], [838/tests], [922/tests], [948/tests], [985/tests], [27178], [32659], [34855], [37563], [40968], [44497], [46262].
See #56793.
Built from https://develop.svn.wordpress.org/trunk@55019
git-svn-id: http://core.svn.wordpress.org/trunk@54552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of WordPress 4.5, taxonomies should be passed to `get_terms()` via the `taxonomy` argument in the `$args` array:
{{{
$terms = get_terms( array(
'taxonomy' => 'post_tag',
'hide_empty' => false,
) );
}}}
The legacy way of passing a taxonomy via the function's first parameter was still mentioned in the documentation, causing some confusion.
This commit updates the function documentation to better highlight the currently recommended approach.
Follow-up to [36614].
Props ramon-fincken, sabernhardt, SergeyBiryukov.
Fixes#57380.
Built from https://develop.svn.wordpress.org/trunk@55018
git-svn-id: http://core.svn.wordpress.org/trunk@54551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$var` parameter to `$value` in `WP_Test_Stream::stream_metadata()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55017
git-svn-id: http://core.svn.wordpress.org/trunk@54550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$function` parameter to `$function_name` in:
* `WP_UnitTestCase_Base::deprecated_function_run()`
* `WP_UnitTestCase_Base::doing_it_wrong_run()`
* Renames the `$object` parameter to `$actual` in:
* `WP_UnitTestCase_Base::assertEqualFields()`
* `WP_UnitTestCase_Base::assertNonEmptyMultidimensionalArray()`
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55016
git-svn-id: http://core.svn.wordpress.org/trunk@54549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$global` parameter to `$is_global` in:
* `update_user_option()`
* `delete_user_option()`
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55015
git-svn-id: http://core.svn.wordpress.org/trunk@54548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$default` parameter to `$default_value` in `get_theme_mod()`.
* Renames the `$include` parameter to `$file` in `require_if_theme_supports()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55014
git-svn-id: http://core.svn.wordpress.org/trunk@54547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$require_once` parameter to `$load_once` in:
* `locate_template()`
* `load_template()`
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55013
git-svn-id: http://core.svn.wordpress.org/trunk@54546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$object` parameter to `$object_type` in `get_object_taxonomies()`.
* Renames the `$parent` parameter to `$parent_term` in:
* `term_exists()`
* `wp_check_term_hierarchy_for_loops()`
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55011
git-svn-id: http://core.svn.wordpress.org/trunk@54544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`WP_Textdomain_Registry` was introduced in [53874] and later adjusted in [54682] to store text domains and their language directory paths, addressing issues with just-in-time loading of textdomains when using locale switching and `load_*_textdomain()` functions.
This change improves how the class stores information about all existing MO files on the site, addressing an issue where translations are not loaded after calling `switch_to_locale()`.
Props johnbillion, ocean90, SergeyBiryukov.
Fixes#57116.
Built from https://develop.svn.wordpress.org/trunk@55010
git-svn-id: http://core.svn.wordpress.org/trunk@54543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When the Requests 2.0.0 [7ef0774f0b/src/Autoload.php (L141-L143) autoloader detects the older (deprecated) `Requests` class], it attempts to load [https://github.com/WordPress/Requests/blob/v2.0.0/library/Requests.php its `/library/Requests.php` file]. Prior to this commit, this file did not exist in Core. Thus, a fatal error happened.
Why not change Requests Autoloader?
Requests is an external dependency that Core consumes. It is also used by other projects outside of Core. Thus, Core needs a fix to guard itself to prevent a fatal error.
The fix:
* Adds the missing `wp-includes/Requests/library/Requests.php` file, which then loads the `wp-includes/class-requests.php` (which will throw a deprecation notice to alert developers to upgrade).
* Adds a test.
Follow-up to [54997].
Props bjorsch, costdev, jrf, mukesh27, peterwilsoncc, ironprogrammer, hellofromTonya.
Fixes#57341.
Built from https://develop.svn.wordpress.org/trunk@55007
git-svn-id: http://core.svn.wordpress.org/trunk@54540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The test for `wp_nonce_field()` with a custom action name verifies that the nonce value matches the one returned by `wp_create_nonce()` with the same action name.
The created nonce, in turn, depends on `wp_nonce_tick()`, which returns a different result in the first and the second half of the nonce's lifespan, one day by default:
* 00:00:01 to 12:00:00 — First tick
* 12:00:01 to 00:00:00 — Second tick
In practice, due to a delay between initializing data providers and running the actual tests, it is possible for the nonce tick to change in the process, for example if the test suite run starts at 11:59:30, and the affected test runs at 12:00:30, causing a test failure.
This commit reduces the chance of a race condition by moving the `wp_create_nonce()` call from the data provider into the test itself.
Includes wrapping long lines with the expected results for better readability.
Follow-up to [54420].
Props NekoJonez, SergeyBiryukov.
See #56793.
Built from https://develop.svn.wordpress.org/trunk@55006
git-svn-id: http://core.svn.wordpress.org/trunk@54539 1a063a9b-81f0-0310-95a4-ce76da25c4cd