MySQL 8.0.17 deprecated the display width attribute for integer data types:
> As of MySQL 8.0.17, the `ZEROFILL` attribute is deprecated for numeric data types, as is the display width attribute for integer data types. You should expect support for `ZEROFILL` and display widths for integer data types to be removed in a future version of MySQL. Consider using an alternative means of producing the effect of these attributes. For example, applications can use the `LPAD()` function to zero-pad numbers up to the desired width, or they can store the formatted numbers in `CHAR` columns.
In practice, this means that display width is removed for integer types when creating a table:
* `BIGINT(20)` → `BIGINT`
* `INT(11)` → `INT`
* `MEDIUMINT(9)` → `MEDIUMINT`
* `SMALLINT(6)` → `SMALLINT`
* `TINYINT(4)` → `TINYINT`
Note: This only applies specifically to MySQL 8.0.17 or later. In MariaDB, display width for integer types is still available and expected.
This commit ensures that `dbDelta()`, which relies on the `DESCRIBE` SQL command to get the existing table structure and field types, when running on MySQL 8.0.17 or later, does not unnecessarily attempt to convert `BIGINT` fields back to `BIGINT(20)`, `INT` back to `INT(11)`, etc. When comparing the field type in the query with the existing field type, if display width is the only difference, it can be safely ignored to match MySQL behavior.
The change is covered by existing `dbDelta()` unit tests:
* A test for not altering `wp_get_db_schema()` queries on an existing install using MySQL 8.0.17+ now passes.
* More than twenty tests which previously failed on PHP 8.0.x + MariaDB due to incorrect expectations, caused by MariaDB version reporting not being consistent between PHP versions, now pass.
References:
* [https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html MySQL: Nymeric Type Attributes]
* [https://mariadb.com/kb/en/data-types-numeric-data-types/ MariaDB: Numeric Data Types]
Follow-up to [1575], [18899], [37525], [47183], [47184].
Props SergeyBiryukov, pbearne, leewillis77, JavierCasares, desrosj, costdev, johnbillion.
Fixes#49364. See #51740.
Built from https://develop.svn.wordpress.org/trunk@53897
git-svn-id: http://core.svn.wordpress.org/trunk@53456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
An earlier regex for normalizing index definitions disables the PHPCS check for extra padding in order to keep a more readable indentation. However, this was missed for index columns regex.
Follow-up to [37583], [42228], [42249], [42343].
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53896
git-svn-id: http://core.svn.wordpress.org/trunk@53455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This allows a developer to use the persistent Memcached object cache on their local development environment via the `LOCAL_PHP_MEMCACHED` environment variable.
Enable the memcached config via `LOCAL_PHP_MEMCACHED=true` in the `.env` file and then restart the environment with `npm run env:restart`.
Fixes#55700
Built from https://develop.svn.wordpress.org/trunk@53895
git-svn-id: http://core.svn.wordpress.org/trunk@53454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is the taxonomy term counterpart to the `is_post_publicly_viewable()` function. Although the logic for terms is more straight forward this serves the same purpose as introducing the corresponding function for posts -- to centralise and reduce the logic needed to validate a term and determine if it's publicly viewable.
Props peterwilsoncc, costdev, johnbillion
Fixes#56215
Built from https://develop.svn.wordpress.org/trunk@53893
git-svn-id: http://core.svn.wordpress.org/trunk@53452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Several query vars only accept a scalar value and pass the value through functions that assume a scalar value. Adding extra guard conditions to the types of query vars doesn't affect their functionality but does remove PHP notices and warnings that can otherwise be generated when a non-scalar value such as an array is present in a query var.
Props juliobox, xknown, SergeyBiryukov, dave1010, nacin, tellyworth, dd32, audrasjb, johnregan3
Fixes#17737
Built from https://develop.svn.wordpress.org/trunk@53891
git-svn-id: http://core.svn.wordpress.org/trunk@53450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
There were two sets of tests for `is_serialized()`:
* One in the `functions.php` file, based on the same file name in core.
* One in a separate class in the `functions` directory.
To avoid confusion and make it easier to decide where new tests should go in the future, the existing tests are now combined in the latter location.
Includes:
* Moving `is_serialized()` and `maybe_serialize()` tests into their own classes.
* Using named data providers to make test output more descriptive.
* Combining test cases and removing duplicates.
Follow-up to [278/tests], [279/tests], [328/tests], [32631], [45754], [47452], [49382], [53886], [53889].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53890
git-svn-id: http://core.svn.wordpress.org/trunk@53449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset introduces new `wp_required_field_indicator()` and `wp_required_field_message()` helper functions to generate reusable and consistent required field indicator and message. It also implements these functions in various admin screens.
Props sabernhardt, ryokuhi, joedolson, audrasjb, SergeyBiryukov.
Fixes#54394.
Built from https://develop.svn.wordpress.org/trunk@53888
git-svn-id: http://core.svn.wordpress.org/trunk@53447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This should help determine whether the current request is for the login screen.
While it does not save a lot of lines of code, including this function in core aims to save developers some time that would otherwise be spent investigating the most reliable way to solve this problem.
Implementation details:
* By checking `wp_login_url()`, the function accounts for custom login locations set via the `login_url` filter.
* By checking `$_SERVER['SCRIPT_NAME']` directly, instead of `did_action( 'login_form_login' )` or `$pagenow` global, the function can work as early as possible, for example in a must-use plugin.
Follow-up to [2481], [6412], [12393], [12732], [15558], [15481], [15746].
Props dcowgill, scribu, donmhico, iandunn, wonderboymusic, nacin, robmiller, kitchin, chriscct7, tazotodua, davidbaumwald, SergeyBiryukov.
Fixes#19898.
Built from https://develop.svn.wordpress.org/trunk@53884
git-svn-id: http://core.svn.wordpress.org/trunk@53443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This removes the requirement that a Super Admin must be a member of the current site when they attempt to set an application password within the admin area of an individual site on the network.
Props TimothyBlynJacobs, ilovecats7, johnbillion, georgestephanis, johnjamesjacoby
Fixes#53224
Built from https://develop.svn.wordpress.org/trunk@53882
git-svn-id: http://core.svn.wordpress.org/trunk@53441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
To help avoid issues with trailing whitespace, omitting the closing PHP tag at the end of a file is preferred.
Props netweb, dd32, yahil, milindmore22, vishalkakadiya, NomNom99, manishsongirkar36, sabernhardt, audrasjb, desrosj.
See #40039.
Built from https://develop.svn.wordpress.org/trunk@53880
git-svn-id: http://core.svn.wordpress.org/trunk@53439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.
* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()` functions to store the path in `WP_Textdomain_Registry`.
* Adds `$locale` parameter to `load_textdomain()` to specify the locale the translation file is for.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have caught this issue earlier.
* Adds a new test plugin and theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.
Previously added in [49236] and reverted in [49236] to investigate concerns which are now addressed here.
Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes#39210.
Built from https://develop.svn.wordpress.org/trunk@53874
git-svn-id: http://core.svn.wordpress.org/trunk@53433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds an `is_string( $taxonomy )` check to the condition in `taxonomy_exists()`, to ensure `false` is returned when the `$taxonomy` is not a string.
Follow-up to [35718].
Props costdev, peterwilsoncc, mukesh27.
Fixes#56338.
See #56336.
Built from https://develop.svn.wordpress.org/trunk@53869
git-svn-id: http://core.svn.wordpress.org/trunk@53428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improve the performance of `WP_List_Table::get_column_info()` by adding the primary column to the cached header values. This reduces the number of calls to the `WP_List_Table::get_primary_column_name()` method to once per table in line with the other header getter functions.
Props bobbingwide, chaion07, costdev, mikeschroder, mukesh27, peterwilsoncc, shetheliving, spacedmonkey.
Fixes#34564.
Built from https://develop.svn.wordpress.org/trunk@53868
git-svn-id: http://core.svn.wordpress.org/trunk@53427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* `WP_Filesystem_FTPext::exists()`
* `WP_Filesystem_FTPext::size()`
* `WP_Filesystem_ftpsockets::exists()`
The `::exists()` methods were previously using the FTP `NLST` command, which works for directories, but is not intended to be applied to a file. This only worked most of the time due to many FTP servers being permissive and allowing to execute `NLST` on files, which cannot be guaranteed and appears to not be the case in newer versions of Pure-FTPd (1.0.48 or later).
With a recent change in [53860], both methods were updated for compatibility with RFC 959:
* Both methods check if the path is a directory that can be changed into (and therefore exists).
* `WP_Filesystem_FTPext` uses `ftp_rawlist()` (FTP `LIST` command) to check for file existence.
* `WP_Filesystem_ftpsockets` uses file size to check for file existence.
Reference: [https://www.ietf.org/rfc/rfc959.txt RFC 959: File Transfer Protocol (FTP)]
Follow-up to [6779], [11821], [25274], [33648], [34733], [35944], [35946], [53860].
See #51170.
Built from https://develop.svn.wordpress.org/trunk@53862
git-svn-id: http://core.svn.wordpress.org/trunk@53421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Make it specifically about `wp_resolve_numeric_slug_conflicts()`, the function that was throwing an `Undefined array key "year"` PHP warning for malformed date requests.
* Move the test under the `rewrite` component and make its name a bit more descriptive.
* Check the return result of the function instead of performing a dummy assertion.
* Use named array keys in the data provider for clarity.
* Add missing `@covers` tag.
Follow-up to [32648], [53857].
Props costdev, peterwilsoncc, 1naveengiri, mukesh27, SergeyBiryukov.
See #52252, #45513.
Built from https://develop.svn.wordpress.org/trunk@53861
git-svn-id: http://core.svn.wordpress.org/trunk@53420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
WordPress FTP file checking was previously based upon `ftp_nlist()`. This function can be problematic at scale with a directory containing a large number of files. The same issue occurred using it with ftpsockets.
This changeset rewrites the FTP `exists()` functions to utilize a more efficient and stable check.
Props giox069, desrosj, mkox, afragen, costdev, pbiron, peterwilsoncc.
Fixes#51170.
See #53318, #39781.
Built from https://develop.svn.wordpress.org/trunk@53860
git-svn-id: http://core.svn.wordpress.org/trunk@53419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset ensures `has_blocks()` doesn't return a fatal error when `$post` is not a valid post. If the post can't be retrieved, the function now returns `false`.
Props Howdy_McGee, costdev, colonelphantom, audrasjb, dlh, peterwilsoncc.
Fixes#55705.
Built from https://develop.svn.wordpress.org/trunk@53858
git-svn-id: http://core.svn.wordpress.org/trunk@53417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Ensure that date queries contain each component before attempting to use them. This prevents http requests triggering notices if a portion of the date is missing. For example a request containing a day and year but no month, a request containing a month bu not year.
Props ovidiul, dd32, peterwilsoncc, costdev, johnbillion, SergeyBiryukov, desrosj, tremidkhar, hellofromTonya.
Fixes#52252.
Built from https://develop.svn.wordpress.org/trunk@53857
git-svn-id: http://core.svn.wordpress.org/trunk@53416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This allows for arbitrary properties to be declared on it.
Alternatively, the `MockClass` could be deprecated altogether in favor of directly using `stdClass` where needed.
Follow-up to [53/tests], [65/tests], [53557], [53558], [53850], [53851], [53852], [53853], [53854].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53856
git-svn-id: http://core.svn.wordpress.org/trunk@53415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
In this case, as the `$badchars` property never changes, declaring this as a class constant is the sensible option.
As for the `$dir` property (which cannot be turned into a constant due to the function call), this is used in multiple tests, so making this property explicit makes sense.
Follow-up to [139/tests], [53557], [53558], [53850], [53851], [53852], [53853].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53854
git-svn-id: http://core.svn.wordpress.org/trunk@53413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
In this particular case, the test class contains a `set_up()` method that sets the `$post_type` property, which is ''used'' by the tests, but never ''changed'' by the tests.
In other words, setting this property in the `set_up()` is an unnecessary overhead and the property should be changed to a class constant.
Follow-up to [1212/tests], [52389], [53557], [53558], [53850], [53851], [53852].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53853
git-svn-id: http://core.svn.wordpress.org/trunk@53412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
In this particular case, the test class contains a `set_up()` method that sets the `$img_meta` property, which is ''used'' by the tests, but never ''changed'' by the tests.
In other words, setting this property in the `set_up()` is an unnecessary overhead and the property should be changed to a class constant.
Includes renaming the test class to match the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization naming conventions].
Follow-up to [52190], [53557], [53558], [53850], [53851].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53852
git-svn-id: http://core.svn.wordpress.org/trunk@53411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The dynamically created `$undefined` property appears to be a copy/paste from the `Tests_WP_Customize_Setting` class, and is not actually used in other test classes:
* `Tests_WP_Customize_Manager`
* `Tests_WP_Customize_Panel`
* `Tests_WP_Customize_Section`
Follow-up to [31329], [32658].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53851
git-svn-id: http://core.svn.wordpress.org/trunk@53410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In this particular case, the test class contains a `set_up()` method which sets properties only used by select tests, while the fixture method is being run for all tests.
There were a few ways this could be fixed:
* As the values do not change across tests, use `set_up_before_class()` to set (static) properties instead.
* For those values which are set up without a function call or variable interpolation, set the values in class constants.
* Or set these values as local variables for those tests which actually use them.
The implemented solution is a combination of options 2 and 3.
Follow-up to [1106/tests], [53557], [53558].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53850
git-svn-id: http://core.svn.wordpress.org/trunk@53409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Correct an issue where the secondary mime type full size image would not be properly resized (and `-scaled` added to the name) when the original upload is over the `big_image_size_threshold` dimensions.
Props mukesh27.
See #55443.
Built from https://develop.svn.wordpress.org/trunk@53848
git-svn-id: http://core.svn.wordpress.org/trunk@53407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a `wp_preload_resources` filter that developers can use to add resource preloading.
Preloading helps the browser discover and prioritize important resources earlier during the page load. This ensures that they are available earlier and are less likely to block the page's render.
Props nico23, swissspidy, igrigorik, westonruter, azaozz, furi3r, aristath, spacedmonkey, peterwilsoncc, mihai2u, gziolo.
Fixes#42438.
Built from https://develop.svn.wordpress.org/trunk@53846
git-svn-id: http://core.svn.wordpress.org/trunk@53405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The function executes an optimized query to get the last revision ID and total count. It was originally introduced for `WP_REST_Posts_Controller::prepare_links()`, and is now used in a few more places in core:
* `register_and_do_post_meta_boxes()`
* `wp_get_post_revisions_url()`
* `wp_update_custom_css_post()`
Follow-up to [53759], [53769], [53778], [53779], [53841].
Props peterwilsoncc, mukesh27, SergeyBiryukov.
Fixes#56279.
Built from https://develop.svn.wordpress.org/trunk@53842
git-svn-id: http://core.svn.wordpress.org/trunk@53401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates `wp_get_latest_revision_id_and_total_count()` and its usage to be a bit more descriptive and a bit less repetitive, e.g. `$revisions['latest_id']` instead of `$revision['revision']`.
Includes updating the `@return` tag to explain when the function returns a `WP_Error`.
Follow-up to [53759], [53769], [53778], [53779].
See #55857.
Built from https://develop.svn.wordpress.org/trunk@53841
git-svn-id: http://core.svn.wordpress.org/trunk@53400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Validate the requested sitemap is a string before attempting to use it in a provider. This prevents `WP_Sitemaps_Registry::get_provider()` from triggering a fatal error in more recent versions of PHP.
The errors can be triggered by items outside the site owner or developers control (such as a user visiting `?sitemap[foo]=bar`) so the code fails silently to avoid filling error logs with unfixable errors.
Props costdev, dd32.
Fixes#56336.
Built from https://develop.svn.wordpress.org/trunk@53838
git-svn-id: http://core.svn.wordpress.org/trunk@53397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
There were two sets of tests for the function:
* One in the `link` directory, based on the `link-template.php` file name.
* One in the `term` directory, based on the component name.
To avoid confusion and make it easier to decide where new tests should go in the future, the existing tests are now combined in the former location.
Includes:
* Setting the current user in `::set_up()` instead of each individual test method.
* Changing the custom taxonomy name to `wptests_tax` for consistency with other tests.
* Moving `::register_custom_taxonomy()` and `::get_term()` helpers to the beginning of the class.
Follow-up to [32954], [36646], [52180], [52255], [53833].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53836
git-svn-id: http://core.svn.wordpress.org/trunk@53395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Follow-up to [53818], [53821], [53822], [53834].
See #56198.
Built from https://develop.svn.wordpress.org/trunk@53835
git-svn-id: http://core.svn.wordpress.org/trunk@53394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string. To avoid potential compatibility issues or key collisions, a string that becomes empty after `trim()` should not be considered a valid cache key.
Follow-up to [53818], [53821], [53822].
Props tillkruess.
See #56198.
Built from https://develop.svn.wordpress.org/trunk@53834
git-svn-id: http://core.svn.wordpress.org/trunk@53393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* The tests use named data providers which include a flag for passing either a term ID or term object to the test, but the values for the flag were the opposite of what the array key says.
* Some array keys were duplicated, which means the earlier test case with the same name did not actually run.
Follow-up to [52180], [52255], [52258], [52305].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53833
git-svn-id: http://core.svn.wordpress.org/trunk@53392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This list was not up to date, and does not appear to be required, as `WP_UnitTestCase_Base::flush_cache()` adds the correct list of groups, which is up to date.
Follow-up to [1332/tests], [8068], [37613], [40561], [52976], [53826], [53828].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53829
git-svn-id: http://core.svn.wordpress.org/trunk@53388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This list was not up to date, and does not appear to be required, as `WP_UnitTestCase_Base::flush_cache()` adds the correct list of groups, which is up to date.
Follow-up to [1332/tests], [40343], [40561], [53823], [53824].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53826
git-svn-id: http://core.svn.wordpress.org/trunk@53385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changes the `$tags` variable used within `wp_set_post_terms()` to `$terms`.
While the default for the `$taxonomy` argument is `post_tag`, the function can be used to assign terms to a post for any taxonomy. When a different taxonomy is passed, `$tags` is an inaccurate name and could be confusing.
Props hilayt24, costdev, SergeyBiryukov, krishaweb, desrosj.
Fixes#56331.
Built from https://develop.svn.wordpress.org/trunk@53825
git-svn-id: http://core.svn.wordpress.org/trunk@53384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This list was not up to date due to missing `blog_meta` group, and does not appear to be required for the tests to pass, as `WP_UnitTestCase_Base::flush_cache()` adds the same list of groups, which is up to date.
Follow-up to [946/tests], [1332/tests], [40343], [42836], [53823].
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53824
git-svn-id: http://core.svn.wordpress.org/trunk@53383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string. To avoid potential compatibility issues or key collisions, float values should not be considered a valid cache key.
Follow-up to [53818], [53821].
Props tillkruess, malthert, spacedmonkey.
See #56198.
Built from https://develop.svn.wordpress.org/trunk@53822
git-svn-id: http://core.svn.wordpress.org/trunk@53381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Some plugins may call the `wp_cache_*()` functions with an empty string, `false`, or `null` as cache key, usually as a result of not checking the return value of another function that's used as the key.
Previously, this was silently failing, leading to odd behavior at best and often breakage due to key collisions.
A valid cache key must be either an integer number or a non-empty string.
This commit introduces a quick type check on the given cache keys and adds a `_doing_it_wrong()` message that should help plugin developers to notice these issues quicker.
Includes:
* A check in `update_user_caches()` and `clean_user_cache()` to make sure user email is not empty before being cached or removed from cache, as it is technically possible to create a user with empty email via `wp_insert_user()`.
* Some minor cleanup in unit tests where the email was passed to `wp_insert_user()` incorrectly or was unintentionally reset.
Props tillkruess, malthert, dd32, spacedmonkey, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes#56198.
Built from https://develop.svn.wordpress.org/trunk@53818
git-svn-id: http://core.svn.wordpress.org/trunk@53377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes WPCS errors in `WP_Site_Health::get_test_plugin_version()` and `::get_test_theme_version()`:
* `Expected exactly one space between closing parenthesis and opening control structure; " " found.`
* `Expected 1 space(s) after closing parenthesis; found 2`
Follow-up to [53816].
See #56134.
Built from https://develop.svn.wordpress.org/trunk@53817
git-svn-id: http://core.svn.wordpress.org/trunk@53376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This displays a more appropriate message in case the site does not have any active plugins or installed themes.
Follow-up to [44986], [45099], [45336].
Props Presskopp, costdev, martin.krcho, Clorith, SergeyBiryukov.
Fixes#56134.
Built from https://develop.svn.wordpress.org/trunk@53816
git-svn-id: http://core.svn.wordpress.org/trunk@53375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset replaces the default "Just another WordPress site" tagline with an empty string for new installations. The reasoning is:
1. Not all themes display the tagline;
2. Not everyone changes the default tagline;
3. When people don't see the tagline in their theme, they may not realize it is still visible in some places, like feeds.
The string "Just another WordPress site" and the related multisite string: "Just another {NETWORK} site" are now only used as a placeholder for the tagline admin option.
Props markjaquith, Denis-de-Bernardy, westi, RyanMurphy, kovshenin, SergeyBiryukov, chriscct7, tyxla, hyperbrand, karmatosed, lukecavanagh, melchoyce, boemedia, khag7, sabernhardt, audrasjb, peterwilsoncc, costdev, martinkrcho, rafiahmedd.
Fixes#6479.
Built from https://develop.svn.wordpress.org/trunk@53815
git-svn-id: http://core.svn.wordpress.org/trunk@53374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes a behavior where a draft created with the same slug as an existing post would set the existing post to a 404.
`wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts, so to ensure that a unique slug is generated, this changeset adds the post data with the 'publish' status to `wp_unique_post_slug()`.
Props Toro_Unit, h2ham, peterwilsoncc, costdev, antonvlasenko, azaozz, ironprogrammer, audrasjb, hellofromTonya.
Fixes#52422.
Built from https://develop.svn.wordpress.org/trunk@53813
git-svn-id: http://core.svn.wordpress.org/trunk@53372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
There are some table prefixes (for example, `7e1_`), which the database will try and parse as values unless they are quoted in backticks. Because not everyone remembers to quote their table names, WordPress discourages use of such prefixes during setup.
To test if the table prefix is valid, WordPress executes a query deliberately trying to generate an error:
> `Unknown column 'wp_' in 'field list'`
which means the prefix is safe to use, as the database was not able to parse it as a value.
Previously, this error would not be displayed to the user in a typical configuration, but would be logged on the server via `wpdb::print_error()`, and in some cases could block the installation.
This commit makes sure the error is still checked to display a proper message in case the prefix needs to be edited, but otherwise is silently discarded instead of being logged.
Follow-up to [37581], [41631], [51582].
Props pento, lazam786, Velochicdunord, irecinius, mikemanzo, dd32, blackawxs, codewhy, psykro, burgiuk, mdrago, maythamalsudany, peterwilsoncc, sumitsingh, deksar, SergeyBiryukov.
Fixes#42362.
Built from https://develop.svn.wordpress.org/trunk@53812
git-svn-id: http://core.svn.wordpress.org/trunk@53371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A separate file in the `actions` directory may have seemed like a good location at the time, but this is the only test left there. For consistency, it is now moved with the other action tests.
Follow-up to [1294/tests], [53806].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53808
git-svn-id: http://core.svn.wordpress.org/trunk@53367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This was previously moved to a separate file to be excluded when running the tests on PHP 5.2.x.
Now that WordPress supports PHP 5.6.x or later, this can be moved back with the other action tests.
Follow-up to [299/tests], [301/tests], [862/tests], [866/tests], [963/tests].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53806
git-svn-id: http://core.svn.wordpress.org/trunk@53365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This replaces the "tag" wording with "hook name" where appropriate, to match the core function signatures.
Includes:
* Introducing a `::get_hook_names()` method instead of `::get_tags()`, keeping the latter as an alias.
* Adding a `hook_name` key to the `::$events` property, keeping `tag` for backward compatibility for now.
* Adding missing `@since` tags for class methods.
Follow-up to [24/tests], [62/tests], [70/tests], [50807], [53804].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53805
git-svn-id: http://core.svn.wordpress.org/trunk@53364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While most of the action functions are aliases for the respective filter functions, using `did_action()` to detect whether a filter has been run is not possible, as it only works specifically for actions.
This is now resolved by introducing a new function, `did_filter()`, which retrieves the number of times a filter has been applied during the current request, bringing parity with `did_action()`.
Follow-up to [4630], [6318], [27294].
Props mordauk, chriscct7, andykeith, nacin, dd32, markparnell, SergeyBiryukov.
Fixes#35357.
Built from https://develop.svn.wordpress.org/trunk@53803
git-svn-id: http://core.svn.wordpress.org/trunk@53362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This renames `$tax` to `$taxonomy_object` and `$s` to `$search` for clarity. The latter is only renamed when used as an internal variable and not referring to the `$s` global.
The list of affected functions:
* `wp_ajax_ajax_tag_search()`
* `wp_ajax_add_link_category`
* `wp_ajax_add_tag()`
* `wp_ajax_get_tagcloud()`
* `wp_ajax_inline_save_tax()`
* `wp_ajax_find_posts()`
Follow-up to [6542], [8901], [10222], [12833], [16771], [16992], [22723], [38698].
Props azouamauriac.
Fixes#55098.
Built from https://develop.svn.wordpress.org/trunk@53801
git-svn-id: http://core.svn.wordpress.org/trunk@53360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset ensures the "Logged in as" link conveys the information about its purpose ("Edit your profile") while the information "Logged in as Jane Doe" is only a simple text.
Props juliemoynat, SergeyBiryukov, joedolson, audrasjb, lopo.
Fixes#55718.
Built from https://develop.svn.wordpress.org/trunk@53796
git-svn-id: http://core.svn.wordpress.org/trunk@53355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In 6.0 there is now a functionality that allows to register selected remote patterns (from the Pattern Directory) via `theme.json`. However, it requires to fully enable all core and remote patterns. This can be a blocker for user adoption.
Many theme authors want to have all core and remote patterns disabled by default using `remove_theme_support( 'core-block-patterns' )`. This changeset ensures they are serving only patterns relevant to their theme.
This changeset removes theme support check from the function that registers remote patterns specified in `theme.json`. This allows theme authors to disable core patterns but then selectively register the ones they want from the Pattern Directory. If a theme author intentionally specifies patterns in `theme.json`, they probably intend for them to be present in the pattern inserter and the check is not required.
This change will make the Pattern Directory more appealing/usable from the theme author's perspective.
Props ndiego, ryelle.
Fixes#56112.
Built from https://develop.svn.wordpress.org/trunk@53793
git-svn-id: http://core.svn.wordpress.org/trunk@53352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change the return type of `_get_cron_array()` to an empty array if the `cron` option is either missing or of an
unexpected type.
This change ensures the return value for no registered events is consistently an empty array. Previously the return
value could be either an empty array or `false`.
Props thakkarhardik, jrf, costdev.
Fixes#53940.
Built from https://develop.svn.wordpress.org/trunk@53791
git-svn-id: http://core.svn.wordpress.org/trunk@53350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A number of assertions are checking for the number of times a hard-coded substring existed in a larger `$haystack`.
These assertions were using `preg_match_all()` to do so, but without actually using a regex.
In these cases, it is more performant (and simpler) to use the PHP native `substr_count()` function, which will yield the same result, without the overhead of regex parsing.
Reference: [https://www.php.net/manual/en/function.substr-count.php PHP Manual: substr_count()]
Follow-up to [711/tests], [38838], [42694], [53558].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53790
git-svn-id: http://core.svn.wordpress.org/trunk@53349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to make the tests more specific. Setting the author appears to be redundant, as the as the authorship is out of scope for these particular tests.
Follow-up to [66/tests], [84/tests], [167/tests], [296/tests], [412/tests], [496/tests], [1026/tests], [1323/tests], [25554], [33041], [34762], [35183].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53787
git-svn-id: http://core.svn.wordpress.org/trunk@53346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset is a follow-up to [53751] which ensures the additional `sources` information stored in attachment metadata are available under `media_details` for each image size in the REST API responses for attachments.
Props mukesh27, eugenemanuilov, mitogh, flixos90, aaemnnosttv.
See #55443.
Built from https://develop.svn.wordpress.org/trunk@53786
git-svn-id: http://core.svn.wordpress.org/trunk@53345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Now that there is a separate test class for `wp_insert_post()` tests, some of the pre-existing tests from the general `Tests_Post` class can be moved there.
Includes:
* Removal of unnecessarily setting the current user to Editor for all tests.
* Removal of unnecessarily setting the cron option to an empty array for all tests.
Follow-up to [496/tests], [36607], [53782], [53783].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53785
git-svn-id: http://core.svn.wordpress.org/trunk@53344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Now that there is a separate test class for `wp_publish_post()` tests, some of the pre-existing tests from the general `Tests_Post` class can be moved there.
Follow-up to [1039/tests], [1174/tests], [46969], [49000].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53783
git-svn-id: http://core.svn.wordpress.org/trunk@53342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Using `assertIsInt()` instead of `assertIsNumeric()` for post IDs.
* Using consistent variable names for post data and retrieved posts.
* Removing added filters before performing assertions, not after.
* Removing unused `Tests_Post::$post_ids` property.
* Correcting the order of arguments in some assertions.
* Converting some `foreach()` loops to data providers.
* Wrapping long lines for better readability.
Follow-up to [13/tests], [14/tests], [167/tests], [496/tests], [1174/tests], [1246/tests], [1287/tests], [1307/tests], [1326/tests], [30510], [33261], [33630], [34762], [46279], [50012], [51438].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53782
git-svn-id: http://core.svn.wordpress.org/trunk@53341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset introduces the `ajax_term_search_results` hook which can be used to filter the term search results returned by the AJAX term query.
Props grandeljay, costdev, ironprogrammer, audrasjb, SergeyBiryukov.
Fixes#55606.
Built from https://develop.svn.wordpress.org/trunk@53781
git-svn-id: http://core.svn.wordpress.org/trunk@53340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc.
This affects:
* `wp_save_post_revision()`
* `wp_prepare_revisions_for_js()`
* `WP_Customize_Manager::filter_revision_post_has_changed()`
Follow-up to [53759], [53769], [53778].
Props peterwilsoncc.
Fixes#55857.
Built from https://develop.svn.wordpress.org/trunk@53779
git-svn-id: http://core.svn.wordpress.org/trunk@53338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The new name is `wp_get_latest_revision_id_and_total_count()`.
This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc.
Follow-up to [53759], [53769].
Props peterwilsoncc.
See #55857.
Built from https://develop.svn.wordpress.org/trunk@53778
git-svn-id: http://core.svn.wordpress.org/trunk@53337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset also introduces the `.word-wrap-break-word` class which can be used to apply `word-wrap: break-word` to admin elements when needed.
Props mitogh, costdev, kapilpaul, alamgircsebd, sabernhardt, anantajitjg, afercia, circlecube, SergeyBiryukov, rafiahmedd, audrasjb.
Fixes#55393.
Built from https://develop.svn.wordpress.org/trunk@53777
git-svn-id: http://core.svn.wordpress.org/trunk@53336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Usage of `get_magic_quotes_gpc()` was removed from `addslashes_gpc()` in [46105] / #47783.
- A similar description fragment was removed from `wp_parse_str()` in that changeset, but this one was missed.
- The `get_magic_quotes_gpc()` function itself was deprecated in PHP 7.4 and removed in PHP 8.0.
Props mitweka, audrasjb, SergeyBiryukov.
Fixes#56233.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53776
git-svn-id: http://core.svn.wordpress.org/trunk@53335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses failures in `has_custom_logo()` and `get_custom_logo()` tests when being run separately:
{{{
1) Tests_General_Template::test_has_custom_logo
Custom logo should not be set after removal.
Failed asserting that true is false.
tests/phpunit/tests/general/template.php:291
2) Tests_General_Template::test_get_custom_logo
Custom logo should not be set after removal.
Failed asserting that a string is empty.
tests/phpunit/tests/general/template.php:336
}}}
Specifically, this ensures that the `site_logo` option gets deleted in `_delete_site_logo_on_remove_theme_mods()`, which in turn prevents the `core/site-logo` block filters from affecting the custom logo tests.
Alternatively, these filters could be removed instead:
{{{
remove_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' );
remove_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
}}}
Follow-up to [36905], [51091], [51421], [52042].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53774
git-svn-id: http://core.svn.wordpress.org/trunk@53333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids an `Attempt to read property "cap" on null` PHP warning when checking an unregistered post type's `publish_posts` capability to disallow contributors setting the post slug for pending posts.
Follow-up to [9055], [42380].
Props Chouby, mukesh27, rafiahmedd, SergeyBiryukov.
Fixes#55877.
Built from https://develop.svn.wordpress.org/trunk@53771
git-svn-id: http://core.svn.wordpress.org/trunk@53330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Renaming the function to `wp_get_last_revision_id_and_total_count()`.
* Making the default value for `$post` consistent with `wp_get_post_revisions()`.
* Making `WP_Error` codes more specific and using them in test assertions.
* Adjusting the function description per the documentation standards.
Follow-up to [53759].
Props JustinSainton, SergeyBiryukov.
See #55857.
Built from https://develop.svn.wordpress.org/trunk@53769
git-svn-id: http://core.svn.wordpress.org/trunk@53328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Placing `WP_Object_Cache::flush_group()` next to `::flush()`.
* Placing `wp_cache_supports_group_flush()` next to `wp_cache_flush_group()`.
* Placing the `wp_cache_flush_group()` unit test next to the `::flush()` method test.
* Removing test name from assertion messages, as it is already mentioned directly above in case of failure.
* Adjusting function descriptions per the documentation standards.
Follow-up to [52706], [53763].
See #55647, #4476.
Built from https://develop.svn.wordpress.org/trunk@53767
git-svn-id: http://core.svn.wordpress.org/trunk@53326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset introduces the `wp_read_audio_metadata` hook which allows to filter metadata extracted from an uploaded audio file.
This brings consistency with corresponding filters available for image and video file types:
- `wp_read_image_metadata` added in [6313] / #5162.
- `wp_read_video_metadata` added in [41746] / #35218.
Props luigipulcini, SergeyBiryukov, mukesh27.
Fixes#55828.
Built from https://develop.svn.wordpress.org/trunk@53764
git-svn-id: http://core.svn.wordpress.org/trunk@53323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a new plugable function called `wp_cache_flush_group`, that will allow developers to clear whole cache groups with a single call. Developers can detect if their current implementation of an object cache supports flushing by group, by calling `wp_cache_supports_group_flush` which returns true if it is supported. If the developers of the object cache drop-in has not implemented `wp_cache_flush_group` and `wp_cache_supports_group_flush`, these functions are polyfilled and `wp_cache_supports_group_flush` defaults to false.
Props Spacedmonkey, filosofo, ryan, sc0ttkclark, SergeyBiryukov, scribu, Ste_95, dd32, dhilditch, dougal, lucasbustamante, dg12345, tillkruess, peterwilsoncc, flixos90, pbearne.
Fixes#4476.
Built from https://develop.svn.wordpress.org/trunk@53763
git-svn-id: http://core.svn.wordpress.org/trunk@53322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the NPM dependencies for the Twenty Twenty-One theme to the latest versions.
Modifications to the built files are included in this commit, which are a result of updating the `sass` dependency to the latest version.
Previously, trailing loud comments (`/* ... */`) were pushed to the next line,. Now the comment location is preserved, resulting in the built CSS files more closely resembling the theme’s SCSS files.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53761
git-svn-id: http://core.svn.wordpress.org/trunk@53320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Do not call the `prepare_links` methods in core REST API controllers, unless the `_links` or `_embedded` fields are requested. There is no need to prepare links if they are never returned in the response. This saves resources, as many calls to `prepare_links` methods perform database queries.
Props Spacedmonkey, timothyblynjacobs, rachelbaker, desrosj, dlh, hellofromTonya.
Fixes#52992.
Built from https://develop.svn.wordpress.org/trunk@53760
git-svn-id: http://core.svn.wordpress.org/trunk@53319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add new function called `wp_get_lastest_revision_id_and_total_count`, that performs an optimized query to get the last revision and total and use it in `WP_REST_Posts_Controller` class.
Props Spacedmonkey, timothyblynjacobs, furi3r, peterwilsoncc.
Fixes#55857.
Built from https://develop.svn.wordpress.org/trunk@53759
git-svn-id: http://core.svn.wordpress.org/trunk@53318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This brings consistency to similar code fragments that evolved in slightly different ways over the years:
* A check that the list of functions is not empty now exists in both editors.
* "Function Name..." is an option label, not an attribute, so `esc_html__()` is the correct function here.
* `esc_attr( urlencode( $function ) )` in the theme editor is replaced with `esc_attr( $function )`.
* `htmlspecialchars( $function )` in the theme editor is replaced with `esc_html( $function )`.
Follow-up to [10607], [10879], [11110], [11173], [11204], [11671], [14989].
Props aristath, justinahinon, poena, audrasjb, pratiweb, SergeyBiryukov.
Fixes#56007.
Built from https://develop.svn.wordpress.org/trunk@53758
git-svn-id: http://core.svn.wordpress.org/trunk@53317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a fatal error if the file is included directly outside of WordPress core, e.g. by HyperDB.
Additionally, replace `WPINC` with `wp-includes`, as the constant may not be defined yet in that context.
Follow-up to [53749], [53750].
See #56268, #55647.
Built from https://develop.svn.wordpress.org/trunk@53755
git-svn-id: http://core.svn.wordpress.org/trunk@53314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds Unicode sequence normalization from NFD to NFC, via the `normalizer_normalize()` PHP function which is available with the recommended `intl` PHP extension.
This fixes an issue where NFD characters were not properly sanitized. It also provides a unit test for NFD sequences (alternate Unicode representations of the same characters).
Props NumidWasNotAvailable, targz, nacin, nunomorgadinho, p_enrique, gitlost, SergeyBiryukov, markoheijnen, mikeschroder, ocean90, pento, helen, rodrigosevero, zodiac1978, ironprogrammer, audrasjb, azaozz, laboiteare, nuryko, virgar, dxd5001, onnimonni, johnbillion.
Fixes#24661, #47763, #35951.
See #30130, #52654.
Built from https://develop.svn.wordpress.org/trunk@53754
git-svn-id: http://core.svn.wordpress.org/trunk@53313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add the loaded php extensions as well as whether the server's image libraries support WebP and AVIF image formats to the data payload sent during upgrade checks. Collecting this data with the WordPress.org API will help the project make more data driven decisions about feature support. Note that all data can still be filtered with the `core_version_check_query_args` filter for privacy reasons.
Props dd32, SergeyBiryukov, mikeschroder, pbiron.
Fixes#48116.
Built from https://develop.svn.wordpress.org/trunk@53753
git-svn-id: http://core.svn.wordpress.org/trunk@53312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds the capability for core media uploads to generate sub sized images in more than a single mime type. The output formats for each mime type can be controlled through a filter. WebP is used as an additional output format for JPEG images by default to improve front end performance.
When generating additional mime types, only images which are smaller than the respective original are retained. By default, additional mime type images are only generated for the built-in core image sizes and any custom sizes that have opted in.
Image meta is updated with a new 'sources' array containing file details for each mime type. Each image size in the 'sizes' array also gets a new 'sources' array that contains the image file details for each mime type.
This change also increases image upload retries to accommodate additional image sizes. It also adds a `$mime_type` parameter to the `wp_get_missing_image_subsizes` function and filter.
This change adds three new filters to enable full control of secondary mime image generation and output:
* A new filter `wp_image_sizes_with_additional_mime_type_support` that filters the sizes that support secondary mime type output. Developers can use this to control the output of additional mime type sub-sized images on a per size basis.
* A new filter `wp_upload_image_mime_transforms` that filters the output mime types for a given input mime type. Developers can use this to control generation of additional mime types for a given input mime type or even override the original mime type.
* A new filter `wp_content_image_mimes` which controls image mime type output selection and order for frontend content. Developers can use this to control the mime type output preference order for content images. Content images inserted from the media library will use the available image versions based on the order from this filter.
Thanks to the many contributors who helped develop, test and give feedback on this feature.
A haiku to summarize:
Upload a JPEG
Images of all sizes
Output as WebPs
Props flixos90, MatthiasReinholz, studiolxv, markhowellsmead, eatingrules, pbiron, mukesh27, joegrainger, mehulkaklotar, tweetythierry, akshitsethi, peterwilsoncc, eugenemanuilov, mitogh, shetheliving, clarkeemily, codekraft, mikeschroder, clorith, kasparsd, spacedmonkey, trevorpfromsandee, jb510, scofennellgmailcom, seedsca, cagsmith, karinclimber, dainemawer, baxbridge, grapplerulrich, sobatkras, chynnabenton, tonylocalword, barneydavey, kwillmorth, garymatthews919, olliejones, imarkinteractive, jeffpaul, feastdesignco, webbeetle, masteradhoc.
See #55443.
Built from https://develop.svn.wordpress.org/trunk@53751
git-svn-id: http://core.svn.wordpress.org/trunk@53310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This renames the file containing the `wpdb` class to conform to the coding standards.
This commit also includes:
* A new `wp-db.php` that loads the new file, for anyone that may have been including the file directly.
* Replacing references to the old filename with the new filename.
Fixes#56268. See #55647.
Built from https://develop.svn.wordpress.org/trunk@53749
git-svn-id: http://core.svn.wordpress.org/trunk@53308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset improves admin forms accessibility by adding labels to the following read-only form fields:
- Network setup screen: new visible label to the four textareas for code users need to paste into their wp-config file and the server configuration file (web.config or .htaccess).
- `setup-config.php`: new visible label to one textarea for code to include in the `wp-config` file manually.
- Admin toolbar: adds an `arial-label` attribute to the old "shortlink" feature (not used anymore but still activable by plugins).
Props sabernhardt, audrasjb, ryokuhi, joedolson.
Fixes#54302.
Built from https://develop.svn.wordpress.org/trunk@53745
git-svn-id: http://core.svn.wordpress.org/trunk@53304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset introduces the `get_header_image` filter, which can be used to modify header image URL returned by `get_header_image()`, in themes that support the Header Image feature.
Props hztyfoon, audrasjb, mukesh27, SergeyBiryukov, costdev.
Fixes#56180.
Built from https://develop.svn.wordpress.org/trunk@53741
git-svn-id: http://core.svn.wordpress.org/trunk@53300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This improves the tag pattern matching for GitHub Action workflows to be more specific. The `*` wildcard in the current patterns matches any character except slash (`/`). While this correctly matches a version like `X.Y.Z`, it could also match non-numeric characters.
This changes patterns to use the `+` character, which matches one or more of the preceding characters (`[0-9]` in this case).
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53736
git-svn-id: http://core.svn.wordpress.org/trunk@53295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When trying to determine the outcome of the previous run for a GitHub Action workflow, the current run is included in the list fetched from the GitHub API.
This adjusts the logic checking for the previous run to account for that and fixes notifications for the first workflow runs of a new branch or tag.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53735
git-svn-id: http://core.svn.wordpress.org/trunk@53294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The function was erroneously calling `is_wp_error()` on the result of a `get_post()` call, which returns `null` on failure, and never returns a `WP_Error` object.
Previously, passing a non-existing post ID to the function would result in a home URL being returned and a few `Attempt to read property "post_type, post_name, hierarchical..." on null` PHP warnings.
This commit ensures `get_post_permalink()` returns `false` on failure, which brings parity with `get_permalink()`.
Includes a unit test to confirm the correct behavior.
Follow-up to [12923], [13023], [32606].
Props renegeuze, manzoorwani.jk.
Fixes#45329.
Built from https://develop.svn.wordpress.org/trunk@53733
git-svn-id: http://core.svn.wordpress.org/trunk@53292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This removes all CSS definitions related to the `.icon16` class. Research shows that current ecosystem usage of this class is extremely minimal.
This selector was used for the Welcome Panel and Welcome Screen in WordPress 3.3 (see [19163] and [19197]. The icons were removed for WordPress 3.5 in [22018], but the related CSS remained, and were also included when the MP6 admin re-skinning was merged in [26072].
Props afercia, mmaumio, isabel_brison, sabernhardt, audrasjb, desrosj.
Fixes#35717.
Built from https://develop.svn.wordpress.org/trunk@53731
git-svn-id: http://core.svn.wordpress.org/trunk@53290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `wp_new_comment()`, `wp_update_comment()`, and `wp_filter_comment()` functions already normalize the `user_ID` parameter internally to `user_id`, which matches the database field name.
This commit aims to bring some consistency when passing the parameter in core.
The corresponding `$user_ID` variable is also renamed to `$user_id` to match the other variables when not referring to the `$user_ID` global, which has an exception in the WordPress coding standards.
Follow-up to [8543], [8720], [12267], [12300], [26491], [28915], [28922], [34799], [49303].
See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53729
git-svn-id: http://core.svn.wordpress.org/trunk@53288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset replaces `#d63638` (contrast ratio: 4.40) with `#b32d2e` (contrast ratio: 5.87) in Plugins screen row action links when the site is in recovery mode.
Props kebbet, mukesh27, joedolson, audrasjb.
Fixes#56190.
Built from https://develop.svn.wordpress.org/trunk@53726
git-svn-id: http://core.svn.wordpress.org/trunk@53285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This moves the `::prepare_links()` methods in REST API classes next to `::prepare_item_for_response()` where they are used, to bring some consistency across the classes and make code navigation easier.
Includes wrapping some long lines for better readability.
Follow-up to [52079], [52051], [52342], [53721], [53722].
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53724
git-svn-id: http://core.svn.wordpress.org/trunk@53283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes two WPCS warnings:
* `Variable "$comment_post_ID" is not in valid snake_case format`
* `Variable "$comment_author_IP" is not in valid snake_case format`
While matching the database fields of the same name, these variables did not follow the WordPress coding standards, and are now renamed to address that.
Note: The name change only affects internal variables and parameters for a few actions receiving a comment post ID:
* `edit_comment`
* `comment_id_not_found`
* `comment_closed`
* `comment_on_trash`
* `comment_on_draft`
* `comment_on_password_protected`
* `pre_comment_on_post`
The change does not affect parameters for functions receiving an array of comment data:
* `wp_insert_comment()`
* `wp_new_comment()`
* `wp_update_comment()`
* `wp_handle_comment_submission()`
The associated array keys still match the database fields: `comment_post_ID` and `comment_author_IP`.
Follow-up to [1706], [2894], [8720], [28427], [28437], [28457], [34799], [53720],
See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53723
git-svn-id: http://core.svn.wordpress.org/trunk@53282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes a `Variable "$comment_post_ID" is not in valid snake_case format` WPCS warning.
`$comment_post_ID`, while matching the database field of the same name, does not follow the WordPress coding standards, so the variable is now renamed to `$comment_post_id`.
Additionally, these variables are renamed for clarity:
* `$tb_id` to `$post_id` (this was not the trackback ID)
* `$tb_url` to `$trackback_url`
Follow-up to [172], [637], [1616],
See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53719
git-svn-id: http://core.svn.wordpress.org/trunk@53278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When registering block through PHP, using `register_block_type` function, newly introduced `ancestor` block setting in `block.json` was not recognised. It worked though, when block is registered from JavaScript.
Props lovor, annezazu.
Fixes#56184.
Built from https://develop.svn.wordpress.org/trunk@53718
git-svn-id: http://core.svn.wordpress.org/trunk@53277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Wrapping longer lines and reducing alignment levels to fit more data on the screen.
* Restoring `esc_attr()` for input values, which may include translatable parts.
* Adding comments to closing `</div>` tags and PHP `endif` statements.
* Reducing the context switching between HTML and PHP.
* Balancing PHP conditionals to better reflect the structure.
* Removing repeated function calls to improve performance.
* Renaming some variables for clarity and consistency.
Follow-up to [470], [601], [963], [1227], [1664], [2746], [3029], [6976], [7230], [11350], [14051], [14553], [21891], [34691], [34749], [37747], [38066], [41182], [41986], [42343], [43571], [48710], [50830], [51892], [53706].
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53710
git-svn-id: http://core.svn.wordpress.org/trunk@53269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Restructure the permalink settings fields so URL formats are communicated to screen readers through `aria-describedby` relationships, avoid the usage of implicitly labeled input fields, labeling the custom permalink format correctly, and clarifying values. Make settings `table` element presentational.
Props rishishah, sabernhardt, kebbet.
Fixes#55498.
Built from https://develop.svn.wordpress.org/trunk@53706
git-svn-id: http://core.svn.wordpress.org/trunk@53265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The associated changes were backported to the 6.0 branch, so the version should be 6.0.1 instead of 6.1.0.
This affects:
* `@since` tag for the `block-templates` feature in `create_initial_theme_features()`.
* `@since` tag for the `show_on_front`, `page_on_front`, and `page_for_posts` options on the REST API settings endpoint.
Follow-up to [53590], [53661].
Props tommusrhodus, johnbillion.
Fixes#56225.
Built from https://develop.svn.wordpress.org/trunk@53704
git-svn-id: http://core.svn.wordpress.org/trunk@53263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, it was used in core and older bundled themes to display the list of allowed tags in the comment form.
Follow-up to [709], [2009], [2012], [2032], [2040], [13030], [14365], [32858], [34316], [34351].
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53703
git-svn-id: http://core.svn.wordpress.org/trunk@53262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since the parameter accepts not only a user's ID, but also a `WP_User` object, `$user` is a more appropriate name, which better aligns with the `$post` parameter of functions that accept a post ID or a `WP_Post` object.
The pre-existing internal `$user` variable which contained a `WP_User` object is renamed to `$user_object` for clarity.
Follow-up to [38955].
Props aristath, poena, afercia, SergeyBiryukov.
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53702
git-svn-id: http://core.svn.wordpress.org/trunk@53261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This removes some duplicate code in favor of calling the `WP_Ajax_UnitTestCase::_setRole()` method created specifically for this purpose and used in other tests.
Follow-up to [500/tests], [37288].
Props martin.krcho.
See #56203.
Built from https://develop.svn.wordpress.org/trunk@53701
git-svn-id: http://core.svn.wordpress.org/trunk@53260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Move the colon inside the `<strong>` tags in some `Error:` prefixes, to match other strings.
* Move the full stop at the end of some sentences outside of the `<strong>` tags used for individual phrases.
Follow-up to [11669], [23844], [53118], [53458], [53476].
Props NekoJonez, Presskopp.
Fixes#56027.
Built from https://develop.svn.wordpress.org/trunk@53700
git-svn-id: http://core.svn.wordpress.org/trunk@53259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This replaces the `VHOST` and `SUBDOMAIN_INSTALL` constant names in a message in `ms_subdomain_constants()` with placeholders, as they don't need to be translated.
Follow-up to [36773].
Props weboccults, hztyfoon, pratiweb.
Fixes#56216.
Built from https://develop.svn.wordpress.org/trunk@53699
git-svn-id: http://core.svn.wordpress.org/trunk@53258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that the post lock data returned by the Heartbeat API is consistent.
Previously, `wp_check_locked_posts()` was updated to return the name of the user currently editing the post, but the `wp_refresh_post_lock()` response did not get a similar change.
Follow-up to [53070].
Props nathan.noom.
Fixes#56197.
Built from https://develop.svn.wordpress.org/trunk@53692
git-svn-id: http://core.svn.wordpress.org/trunk@53251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Syncing stable blocks from the Gutenberg repository to wordpress-develop was a manual process, but it got automated with the script that runs together with syncing WordPress packages changed in the Gutenberg package.
Props zieladam.
Fixes#56179.
Built from https://develop.svn.wordpress.org/trunk@53688
git-svn-id: http://core.svn.wordpress.org/trunk@53247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* These were not used consistently, with only four instances across all the tests.
* Using this tag in combination with the `beStrictAboutCoversAnnotation="true"` setting will mark a test as "Risky" if code is executed during the test which is not annotated via `@covers` or `@uses` tags. That would make the maintainance of the tags very fiddly, while adding little additional value for the test code base.
Follow-up to [32995], [39914], [42636], [53682].
Props jrf.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53687
git-svn-id: http://core.svn.wordpress.org/trunk@53246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
There were two kinds of tests in this file:
* Tests for content of some files in the root directory:
* `license.txt`
* `SECURITY.md`
* `package.json`
* Tests for some utility functions of the test framework itself:
* `strip_ws()`
* `test_mask_input_value()`
The latter are now moved to their own file, `utils.php`.
Follow-up to [22/tests], [81/tests], [103/tests], [25240], [26940], [28064], [28480], [28493], [28523], [28631], [42381], [47403], [53683].
See #39265, #55652.
Built from https://develop.svn.wordpress.org/trunk@53686
git-svn-id: http://core.svn.wordpress.org/trunk@53245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Deprecate `wp_get_attachment_thumb_file()`.
- Make `wp_get_attachment_thumb_url()` an alias of `wp_get_attachment_image_url()`. This fixes it to return the proper thumbnail URL and fall back to returning the URL to `image_meta['thumb']` if only that exists.
Props: markhowellsmead, mukesh27, csesumonpro, SergeyBiryukov, mikeschroder, killua99, joemcgill, mashukushibiki, mfgmicha, swissspidy, romulodl, nacin, JoshuaAbenazer, wonderboymusic, lonnylot, azaozz.
Built from https://develop.svn.wordpress.org/trunk@53685
git-svn-id: http://core.svn.wordpress.org/trunk@53244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Ensure the database port number is recorded as an integer or `null` (the default port) when parsing the database host.
This is to prevent PHP/MySQLi throwing an exception caused by ports represented as numeric strings.
Props audrasjb, azouamauriac, chaion07, costdev, johnjamesjacoby, jrf, sergeybiryukov.
Fixes#54877.
Built from https://develop.svn.wordpress.org/trunk@53670
git-svn-id: http://core.svn.wordpress.org/trunk@53229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
No longer delete the default term option in `unregister_taxonomy()` to improve database performance.
Since taxonomies are registered at runtime and can't be unregistered unless they're already registered, prior to this
change the option was created and deleted on each request.
Deleting the option should occur on a one-time opperation such as plugin deactivation.
Follow up to [48480].
Props dlh.
Fixes#54472.
Built from https://develop.svn.wordpress.org/trunk@53669
git-svn-id: http://core.svn.wordpress.org/trunk@53228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Patterns on the [https://wordpress.org/patterns/ Pattern Directory] can have keywords for better discoverability while searching. The way these are stored [69548ff1f0 was changed from a taxonomy to meta value], but the `/wp/v2/pattern-directory/patterns` endpoint was still pulling from that old value.
The correct property to use for this field is `meta.wpop_keywords`, which returns a single string with comma-separated keywords.
Props ryelle, TimothyBlynJacobs.
See #56126.
Built from https://develop.svn.wordpress.org/trunk@53665
git-svn-id: http://core.svn.wordpress.org/trunk@53224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The intention was for the preview ratio to remain accurate for the user's screen size when the sidebar is open, but this appears to have caused unintended side effects to the preview alignment.
Follow-up to [52647].
Props superbthemescom, Presskopp.
Fixes#56097. See #54764.
Built from https://develop.svn.wordpress.org/trunk@53663
git-svn-id: http://core.svn.wordpress.org/trunk@53222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This brings a new version of the Gutenberg code from the [https://github.com/WordPress/gutenberg/tree/wp/6.0 wp/6.0 branch] into core.
Original PR from Gutenberg repository:
* #GB42131 Post Comments Form: Fix warning i18n
The following packages were updated:
* `@wordpress/block-directory` to `3.4.13`
* `@wordpress/block-library` to `7.3.13`
* `@wordpress/customize-widgets` to `3.3.13`
* `@wordpress/edit-post` to `6.3.13`
* `@wordpress/edit-site` to `4.3.13`
* `@wordpress/edit-widgets` to `4.3.13`
Props zieladam, bernhard-reiter, tobifjellner.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53657
git-svn-id: http://core.svn.wordpress.org/trunk@53216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When querying 'fields' equal to 'all' using the `WP_User_Query` class, this returns an array of `WP_User` objects. A `WP_User` object requires user meta to be primed, as the user's role is stored in user meta. Ensure that all users meta is primed in a single request by calling the `cache_users` function when querying 'fields' equal to 'all'. Soft deprecate fields equal to `all_with_meta` as it now acts the same as 'fields' equal to 'all'.
Props Spacedmonkey, peterwilsoncc, mehulkaklotar, timothyblynjacobs, furi3r.
Fixes#55594.
Built from https://develop.svn.wordpress.org/trunk@53655
git-svn-id: http://core.svn.wordpress.org/trunk@53214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This should make cron spawning faster on LSAPI by ensuring that cron requests return immediately.
To avoid code repetition, the no caching headers are relocated and always sent. Caching plugins attempting to set these
headers later will replace those set by WordPress Core.
Follow up to [44488].
Props maximej, johnbillion.
Fixes#54668.
Built from https://develop.svn.wordpress.org/trunk@53653
git-svn-id: http://core.svn.wordpress.org/trunk@53212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Meetup.com was previously removed as an oEmbed source, since they have deprecated their endpoint. The block has also been removed from the editor, see #GB35085.
This commit updates the associated changelog entry for the `oembed_providers` filter to version 6.0.1, as the change is being backported to the 6.0 branch.
Follow-up to [53540].
See #55997.
Built from https://develop.svn.wordpress.org/trunk@53646
git-svn-id: http://core.svn.wordpress.org/trunk@53205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This brings a new version of the Gutenberg code from the [https://github.com/WordPress/gutenberg/tree/wp/6.0 wp/6.0 branch] into core.
The following packages were updated:
* `@wordpress/block-directory` to `3.4.12`
* `@wordpress/block-editor` to `8.5.9`
* `@wordpress/block-library` to `7.3.12`
* `@wordpress/components` to `19.8.5`
* `@wordpress/customize-widgets` to `3.3.12`
* `@wordpress/edit-post` to `6.3.12`
* `@wordpress/edit-site` to `4.3.12`
* `@wordpress/edit-widgets` to `4.3.12`
* `@wordpress/editor` to `12.5.9`
* `@wordpress/format-library` to `3.4.9`
* `@wordpress/icons` to `8.2.3`
* `@wordpress/interface` to `4.5.6`
* `@wordpress/list-reusable-blocks` to `3.4.5`
* `@wordpress/nux` to `5.4.5`
* `@wordpress/plugins` to `4.4.3`
* `@wordpress/preferences` to `1.2.5`
* `@wordpress/reusable-blocks` to `3.4.9`
* `@wordpress/server-side-render` to `3.4.6`
* `@wordpress/widgets` to `2.4.9`
Props zieladam.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53644
git-svn-id: http://core.svn.wordpress.org/trunk@53203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to provide better context and more details if an unexpected `_doing_it_wrong()` message or deprecation notice is encountered during a test run.
Previously, this would display a message like `Unexpected incorrect usage notice for [...]`, but without any further details, making it harder to track down the actual issue.
Follow-up to [25402], [25408], [25785], [37861], [51872].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53637
git-svn-id: http://core.svn.wordpress.org/trunk@53196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This brings parity with WordPress core `wp_die()` handlers and ensures that if a `WP_Error` object is passed as the `$message` argument to `wp_die()`, the PHPUnit test suite displays the error message correctly.
Previously, this would cause a silent fatal error: `Object of class WP_Error could not be converted to string`, leading to just displaying `wp_die called` without any further details.
Follow-up to [28797], [41966], [44666], [45160], [47882].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53634
git-svn-id: http://core.svn.wordpress.org/trunk@53193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects:
* `wp-includes/blocks/index.php`
* `tools/webpack/blocks.js`
* `_unhook_block_registration()` in `tests/phpunit/includes/functions.php`
Follow-up to [47250], [52069], [52730], [53157], [53278].
Fixes#56131.
Built from https://develop.svn.wordpress.org/trunk@53633
git-svn-id: http://core.svn.wordpress.org/trunk@53192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The URL to create a new menu from the the Navigation Menu widget can be a `javascript:` link to the Customizer Menus panel, so `esc_attr()` is used here instead of `esc_url()`.
Follow-up to [53092].
Props hztyfoon.
Fixes#56128.
Built from https://develop.svn.wordpress.org/trunk@53630
git-svn-id: http://core.svn.wordpress.org/trunk@53189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This includes:
* Removing the deprecated `screen_icon()` function call.
* Replacing the deprecated `get_current_theme()` function call with `get_option( 'current_theme' )`.
* Using `wp_get_theme()->display( 'Name' )` explicitly instead of relying on `WP_Theme`'s `__toString()` method, for clarity.
Follow-up to [6334], [20039], [20040], [20042], [20508], [26537], [41274].
Props Presskopp, cu121, viralsampat, costdev, tomjdv, sabernhardt, SergeyBiryukov.
Fixes#54833.
Built from https://develop.svn.wordpress.org/trunk@53626
git-svn-id: http://core.svn.wordpress.org/trunk@53185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.
Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/40799#40799: Ensure only the main query is modified when resolving template for new posts]
Follow-up to [52316].
Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53593
git-svn-id: http://core.svn.wordpress.org/trunk@53181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `workflow_run` event was added to restore Slack notifications for older branches (5.8 and older) without having to backport any changes while alternate approaches were explored.
The workflow has been tested and refined as a reusable one in `trunk`, and this approach is superior to the `workflow_run` event in several ways.
Primarily, the `workflow_run` event results in a separate workflow run being created for sending Slack notifications after the completion of each workflow triggered by `push`. When called as a reusable workflow, this does not happen and the additional jobs are instead added to the initial workflow. This makes which jobs are sending notifications for the current workflow more clear, and reduces the amount of noise (less workflow runs overall).
The `workflow_run` event also makes some data available in different ways than `push` events. By removing it, much of the logic within the workflow can be simplified.
See #56095.
Built from https://develop.svn.wordpress.org/trunk@53591
git-svn-id: http://core.svn.wordpress.org/trunk@53179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This adjusts the newly added options in the settings endpoint to use the `integer` type instead of `number`. Since these are page IDs and are not supposed to be floats, `integer` is the correct type.
Follow-up to [53588].
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53589
git-svn-id: http://core.svn.wordpress.org/trunk@53177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset fills the existing help tab with more detailed information about available row actions in the Media Library, when using the List view.
Props kebbet, audrasjb, costdev, SergeyBiryukov, mukesh27.
Fixes#55800.
Built from https://develop.svn.wordpress.org/trunk@53586
git-svn-id: http://core.svn.wordpress.org/trunk@53174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Wrapping long single-line comments to multi-line for better readability.
* Formatting code blocks to display correctly on the Code Reference.
* Other minor edits for consistency.
This applies to:
* `wpdb::$allow_unsafe_unquoted_parameters`
* `wpdb::escape_identifier()`
* `wpdb::_escape_identifier_value()`
* `wpdb::prepare()`
* `wpdb::has_cap()`
Follow-up to [53575].
See #52506, #55646.
Built from https://develop.svn.wordpress.org/trunk@53584
git-svn-id: http://core.svn.wordpress.org/trunk@53172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the following GitHub Actions to the latest versions:
- `actions/checkout`
- `actions/cache`
- `actions/github-script`
- `actions/setup-node`
- `codecov/codecov-action`
- `shivammathur/setup-php`
- `slackapi/slack-github-action`
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53581
git-svn-id: http://core.svn.wordpress.org/trunk@53170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the following `devDependencies` to newer versions:
- `dotenv` from `16.0.0` to `16.0.1`.
- `grunt` from `1.5.2` to `1.5.3`.
- `grunt-contrib-qunit` from `6.0.0` to `6.2.0`.
- `grunt-contrib-uglify` from `5.2.1` to `5.2.2`.
- `qunit` from `2.18.2` to `2.19.1`.
- `sass` from `1.51.0` to `1.53.0`.
- `sinon` from `13.0.2` to `14.0.0`.
- `uglify-js` from `3.15.4` to `3.16.1`.
Additionally, `npm audit fix` has been run to update dependencies with vulnerabilities.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53580
git-svn-id: http://core.svn.wordpress.org/trunk@53169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a `Constant WPINC already defined in src/wp-settings.php on line 16` PHP warning, which happens when running a WordPress install out of the `src` directory after `npm run build:dev`.
Add a comment to clarify the check for built assets and the direct mention of `wp-includes`.
Follow-up to [53518].
Props aristath.
See #54233.
Built from https://develop.svn.wordpress.org/trunk@53579
git-svn-id: http://core.svn.wordpress.org/trunk@53168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The [https://make.wordpress.org/core/2021/02/19/feature-plugin-rollback-update-failure/ Rollback Update Failure feature project] 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.
If the [https://wordpress.org/plugins/rollback-update-failure/ Rollback Update Failure plugin] is installed, `WP_Upgrader::install_package()` will use the `move_dir()` function from there for better performance. Instead of copying a directory from one location to another, it uses the `rename()` PHP function to speed up the process, which is instrumental in creating a temporary backup without a delay. If the renaming failed, it falls back to `copy_dir()` WP function.
This conditional aims to facilitate broader testing of the feature. It is temporary, until the plugin is merged into core.
Props afragen, pbiron, costdev, davidbaumwald, audrasjb, jrf, SergeyBiryukov.
Fixes#56057. See #51857, #54166.
Built from https://develop.svn.wordpress.org/trunk@53578
git-svn-id: http://core.svn.wordpress.org/trunk@53167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to improve performance of the tests by reducing the number of function calls.
Since `$wpdb::placeholder_escape()` saves the result in a static variable on the first run, there is no need for repeated function calls during the same request or test run, as the result would still be the same.
Follow-up to [42056].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53577
git-svn-id: http://core.svn.wordpress.org/trunk@53166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
For accessibility, input fields should identify their "purpose". The HTML5 attribute `autocomplete` allows for various user data to be quickly autofilled while adding context for some assistive technologies.
This commit adds the appropriate autofill purposes for an author's name, email, and website URL in the comment form template.
Props juliemoynat, bhrugesh96, sabernhardt.
Fixes#55779.
Built from https://develop.svn.wordpress.org/trunk@53576
git-svn-id: http://core.svn.wordpress.org/trunk@53165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
WordPress does not currently provide an explicit method for escaping SQL table and column names. This leads to potential security vulnerabilities, and makes reviewing code for security unnecessarily difficult. Also, static analysis tools also flag the queries as having unescaped SQL input.
Tables and column names in queries are usually in-the-raw, since using the existing `%s` will straight quote the value, making the query invalid.
This change introduces a new `%i` placeholder in `$wpdb->prepare` to properly quote table and column names using backticks.
Props tellyworth, iandunn, craigfrancis, peterwilsoncc, johnbillion, apokalyptik.
Fixes#52506.
Built from https://develop.svn.wordpress.org/trunk@53575
git-svn-id: http://core.svn.wordpress.org/trunk@53164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
One of these was previously renamed to mention `update_metadata_by_mid()`.
While `update_metadata_by_mid()` is indeed called in `wp_ajax_add_meta()` to update an existing meta value, the functionality change that the test intended to verify was in the latter function.
Follow-up to [44153], [53561].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53572
git-svn-id: http://core.svn.wordpress.org/trunk@53161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[https://github.com/WordPress/gutenberg/issues/38719 In 5.9 these utility classnames were removed], which removed the ability for theme/plugin authors to assign their own custom CSS related to specific layout selections. This was mostly related to the Button block.
This commit adds these classes dynamically based on attributes, rather than saving them to the serialized content.
Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/41487#41487 Add utility classnames back to blocks that have layout attributes specified]
Props glendaviesnz, peterwilsoncc, andrewserong, zieladam, matveb, samikeijonen.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53568
git-svn-id: http://core.svn.wordpress.org/trunk@53157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`use_block_editor_for_post_type` and `use_block_editor_for_post` can be very useful in more contexts than wp-admin, especially when a site is in transition. For example, you may want to do things on init that are different.
Neither function depends on other functions that are available only in wp-admin (other than use_block_editor_for_post() relying on use_block_editor_for_post_type() and an admin-referrer check that's historically gated by a query variable and now also gated by is_admin), therefore moving them to wp-includes seems both feasible and beneficial
Props ethitter, jorbin.
Fixes#51819.
Built from https://develop.svn.wordpress.org/trunk@53559
git-svn-id: http://core.svn.wordpress.org/trunk@53148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
In this particular case, the test class contains a `set_up()` method that sets a group of properties, which are ''used'' by the tests, but never ''changed'' by the tests.
In other words, setting these properties in the `set_up()` is an unnecessary overhead and the properties should be changed to class constants.
Notes:
* As the `$img_html` property, which was previously being set, is not actually used in any of the tests, that property has not been converted to a constant.
* The values which were previously being set using a heredoc, now use a nowdoc (supported since PHP 5.3), as they don't contain any interpolation.
* The use of constant scalar expressions (`IMG_URL`) and constant arrays (`IMG_META`) in class constants is supported since PHP 5.6.
Follow-up to [711/tests], [1260/tests], [34855], [41724], [53557].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53558
git-svn-id: http://core.svn.wordpress.org/trunk@53147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
In this particular case, the test classes contain a `set_up()` method that sets a group of properties, which are ''used'' by the tests, but the values of these properties are never ''changed'' by the tests.
In other words, setting these properties in the `set_up()` is an unnecessary overhead and the properties should be changed to class constants.
Follow-up to [1041/tests], [1071/tests].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53557
git-svn-id: http://core.svn.wordpress.org/trunk@53146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Give the test method a most descriptive name.
* Use a single assertion for the URL list instead of a `foreach` loop to provide more context in case of failure.
* Add a failure message to each assertion, as there are multiple assertions used in the test.
Follow-up to [53548].
See #55633.
Built from https://develop.svn.wordpress.org/trunk@53556
git-svn-id: http://core.svn.wordpress.org/trunk@53145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`true` is now passed to the `fail_ci_if_error` input when the `codecov/codecov-action` action is used.
When uploading a code coverage report is unsuccessful, the action will now fail and return an error. This will help avoid situations like #56022 where the report was suddenly failing to upload even though the workflow itself appeared to be successful.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53554
git-svn-id: http://core.svn.wordpress.org/trunk@53143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This adds the `pull_request` event to the Code Coverage Report workflow, allowing changes to be verified in a pull request before being committed.
The `branches` and `paths` filters are used to limit when the workflow runs to pull requests with:
- A base branch of `trunk`.
- Changing specific files that can potentially affect the way a coverage report is generated.
Reports generated on `pull_request` events are for testing purposes only and are not submitted to Codecov.
The `docker-compose.yml` file has also been added to the `paths` filter for both `push` and `pull_request` events. Changes to this file could potentially affect the environment used to generate the report (such as the ones in [53552]).
Props afragen, johnbillion, desrosj.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53553
git-svn-id: http://core.svn.wordpress.org/trunk@53142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
One change in the update from Xdebug version 2.x to 3.x was a shift from enabling features to switching into modes.
When the version of Xdebug installed in the PHP 7.4 Docker container was updated from 2.x to 3.x, the code coverage reporting workflow stopped generating reports due to a lack of available coverage drivers.
This change adds the `XDEBUG_MODE` environment variable to the local Docker environment configuration to allow the active modes to be changed. This environment variable takes precedence over the `xdebug.mode` setting, but will not change the value of the `xdebug.mode` setting.
The `LOCAL_PHP_XDEBUG_MODE` environment variable has been added to the `.env` file and can be used to change the modes enabled in the Docker container. The code coverage reporting workflow uses this variable to enable the `coverage` mode, which is required for generating a test coverage report.
By default, `debug` and `debug modes are active, which enables the more commonly used features of Xdebug: development helpers and step debugging.
Props afragen, johnbillion, desrosj.
Fixes#56022.
Built from https://develop.svn.wordpress.org/trunk@53552
git-svn-id: http://core.svn.wordpress.org/trunk@53141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Cache result of database queries in `_find_post_by_old_slug` and `_find_post_by_old_date` functions. This means that repeated requests to a url where the page is not found, will result in hitting a cache for sites running persistent object caching.
Props Spacedmonkey, dd32, mukesh27, pbearne, flixos90.
Fixes#36723.
Built from https://develop.svn.wordpress.org/trunk@53549
git-svn-id: http://core.svn.wordpress.org/trunk@53138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$filesize` value being included in the returned array.
This affects:
* `wp_generate_attachment_metadata()`
* `wp_get_attachment_metadata()`
* `WP_Image_Editor::save()`
* `WP_Image_Editor_GD::save()` and `::_save()`
* `WP_Image_Editor_Imagick::save()` and `::_save()`
Follow-up to [22094], [22619], [52837], [53546].
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53547
git-svn-id: http://core.svn.wordpress.org/trunk@53136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since WordPress 3.5, `wp_save_image_file()` uses `WP_Image_Editor` classes under the hood to save the images.
While the `save()` method in those instances returns `array|WP_Error` and is documented as such, the return type of the `wp_save_image_file()` function was still left as `bool`.
A better solution would be to adjust the function to return the documented boolean type. However, doing that after 20+ major WP releases would be a backward compatibility break, so the documentation is now updated instead.
Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$image` parameter expecting a `WP_Image_Editor` instance.
* Adding a `@since` note for the `$filesize` value being included in the returned array.
Follow-up to [22094], [22619], [52837].
Props jrf, SergeyBiryukov.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53546
git-svn-id: http://core.svn.wordpress.org/trunk@53135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Move logic to generate link to global styles to the `prepare_links` method in theme REST API controller. This way all logic to generate links is within the `prepare_links` method, bringing this controller inline with other REST API controllers.
Props SergeyBiryukov, Spacedmonkey.
Fixes#56018.
Built from https://develop.svn.wordpress.org/trunk@53544
git-svn-id: http://core.svn.wordpress.org/trunk@53133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Making the test method names more specific.
* Converting one-off helper methods to static closures.
* Adding a failure message to each assertion when multiple assertions are used in the test.
Follow-up to [1126/tests], [1201/tests], [53292], [53495], [53522], [53538].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53541
git-svn-id: http://core.svn.wordpress.org/trunk@53130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset removes Meetup as an oEmbed source, since Meetup.com have deprecated their oEmbed endpoint. The block has already been removed from the editor, see GB#35085.
Props peterwilsoncc, audrasjb, swissspidy.
Fixes#55997.
Built from https://develop.svn.wordpress.org/trunk@53540
git-svn-id: http://core.svn.wordpress.org/trunk@53129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.
Follow-up to [1126/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531], [53537].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53538
git-svn-id: http://core.svn.wordpress.org/trunk@53127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This one test was testing three different situations. When one assertion fails, the rest of the test would not be executed, so this leads to hiding one error behind another.
Splitting the test into three distinct test methods still allows for testing each situation, but tests each one in isolation and won't hide errors.
The third part of the test, dealing with image editor engine classes, will also now use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.
* Reusing an existing data provider with the available image editor engine classes.
Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53537
git-svn-id: http://core.svn.wordpress.org/trunk@53126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, in case of failure, `WP_UnitTestCase_Base::assertNotWPError()` displayed the actual error message from the passed `WP_Error` object, but only if the `$message` parameter was empty.
This made the assertion less helpful, as the actual error message was lost in case there was a non-empty `$message` parameter passed to the method, as per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#using-assertions Writing PHP Tests] guidelines:
> All PHPUnit assertions, as well as all WordPress custom assertions, allow for a `$message` parameter to be passed. This message will be displayed when the assertion fails and can help immensely when debugging a test. This parameter should always be used if more than one assertion is used in a test method.
This commit ensures that the actual error message is always displayed, in addition to the passed `$message` parameter.
The same applies to `WP_UnitTestCase_Base::assertNotIXRError()`.
Follow-up to [34638], [40417].
Props jrf, SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53536
git-svn-id: http://core.svn.wordpress.org/trunk@53125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This adjusts the logic used to determine the outcome of the previous workflow run of the current one to account for `schedule` and `workflow_dispatch` events.
In the current state, only workflows triggered by `push` events are examined. This is causing failures when trying to post Slack notifications for the Test Coverage workflow, and inconsistent results for `workflow_dispatch` events when testing older branches on a schedule.
Follow up to [53466] and [53468].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53534
git-svn-id: http://core.svn.wordpress.org/trunk@53123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
* Adding a failure message to each assertion.
* Adding a skip annotation for unsupported mime types.
* Making the test method name more specific.
Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53531
git-svn-id: http://core.svn.wordpress.org/trunk@53120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
* Adding a failure message to each assertion.
* Making the test method name more specific.
Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53530
git-svn-id: http://core.svn.wordpress.org/trunk@53119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
* Adding a skip annotation for unsupported mime types.
* Adding a failure message to each assertion.
Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53529
git-svn-id: http://core.svn.wordpress.org/trunk@53118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
Follow-up to [184/tests], [53495], [53497], [53521], [53523], [53524], [53525].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53526
git-svn-id: http://core.svn.wordpress.org/trunk@53115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Changing the conditional addition of the `.ico` file type to be unconditional, it was only needed for PHP < 5.3.
* Adding a `@covers` annotation.
Follow-up to [184/tests], [42780], [53495], [53497], [53521], [53523], [53524].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53525
git-svn-id: http://core.svn.wordpress.org/trunk@53114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
Follow-up to [184/tests], [53495], [53497], [53521], [53523].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53524
git-svn-id: http://core.svn.wordpress.org/trunk@53113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Changing the conditional addition of the `.ico` file type to be unconditional, it was only needed for PHP < 5.3.
* Adding a `@covers` annotation.
Follow-up to [184/tests], [42780], [53495], [53497], [53521].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53523
git-svn-id: http://core.svn.wordpress.org/trunk@53112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This introduces a new test helper function which allows for turning a single-level array containing text strings into a data provider with named data sets, where the value of the data set will also be used as the name of the data set.
The function contains safeguards to ensure that it is only used with data compatible with this principle and will throw generic PHP exceptions when the data is incompatible. These type of exceptions will be displayed before the tests even start running and will stop the test run when they occur.
While generally speaking, all test cases ''should'' extend the base `WP_UnitTestCase_Base` class, this is still made a `public static` method to allow for a test, which by exception directly extends the PHPUnit base `TestCase` or the `PHPUnit_Adapter_TestCase`, to also be able to use this method.
Typical usage of this method:
{{{
public function data_provider_for_test_name() {
$array = array(
'value1',
'value2',
);
return $this->text_array_to_dataprovider( $array );
}
}}}
The returned result will look like:
{{{
array(
'value1' => array( 'value1' ),
'value2' => array( 'value2' ),
)
}}}
Props jrf, hellofromTonya, adamsilverstein.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53521
git-svn-id: http://core.svn.wordpress.org/trunk@53110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that the global is explicitly declared and documented in:
* `get_next_posts_link()`
* `get_posts_nav_link()`
* `get_the_posts_navigation()`
* `get_the_posts_pagination()`
* `get_next_comments_link()`
Follow-up to [30065].
Props mt8.biz, sabernhardt.
Fixes#43164.
Built from https://develop.svn.wordpress.org/trunk@53520
git-svn-id: http://core.svn.wordpress.org/trunk@53109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changes removes an hardcoded CSS color value for the Quote block in Twenty Twenty-One's editor stylesheet. This ensures custom text color is fully reflected in the Editor for Quote block.
Props jyolsna, evildon, kajalgohel, audrasjb.
Fixes#55989.
Built from https://develop.svn.wordpress.org/trunk@53517
git-svn-id: http://core.svn.wordpress.org/trunk@53106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changes removes an hardcoded CSS color value for the Quote block in Twenty Nineteen's editor stylesheet. This ensures custom text color is fully reflected in the Editor for Quote block.
Props nithi22, evildon, SergeyBiryukov, audrasjb.
Fixes#55992.
Built from https://develop.svn.wordpress.org/trunk@53515
git-svn-id: http://core.svn.wordpress.org/trunk@53104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* As of WordPress 3.6.1, the `html5` feature requires an array of types to be passed. Defaults to `comment-list`, `comment-form`, `search-form` for backward compatibility.
* As of WordPress 6.0, the previously added `_doing_it_wrong()` notice is actually displayed as expected.
Follow-up to [25193], [25235], [25785], [49344], [49354], [52828].
Props bobbingwide.
See #51657, #55646.
Built from https://develop.svn.wordpress.org/trunk@53513
git-svn-id: http://core.svn.wordpress.org/trunk@53102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that not only the array values being compared are equal, but also that their type is the same.
Going forward, stricter type checking by using `assertSameSets()` or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable.
Follow-up to [48939], [51137], [51943], [53499], [53504], [53506], [53509].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53510
git-svn-id: http://core.svn.wordpress.org/trunk@53099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Make the function description more specific, for consistency with other similar functions.
* Add a `@since` note for the `$update_menu_item_cache` parameter of `WP_Query::parse_query()`.
* Add missing `@covers` tags for the unit tests.
Follow-up to [53504].
See #55620.
Built from https://develop.svn.wordpress.org/trunk@53508
git-svn-id: http://core.svn.wordpress.org/trunk@53097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prime caches for all post parents in the post REST API controller using the `_prime_post_caches` function. Post parent objects are required as part of the `check_read_permission` method’s permission check in post REST API controller.
Props spacedmonkey, furi3r, peterwilsoncc, mitogh, madpixels.
Fixes#55593.
Built from https://develop.svn.wordpress.org/trunk@53506
git-svn-id: http://core.svn.wordpress.org/trunk@53095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When using multilingual websites, this string could end up with multiple different translations in the error log, making it less actionable.
Unlike errors displayed to the user, a general consensus for software is that errors in logs should always be in English. Since MySQL errors are also returned in English, this brings more consistency to the logs.
Follow-up to [6391], [8168], [19760].
Props malthert.
Fixes#53125.
Built from https://develop.svn.wordpress.org/trunk@53505
git-svn-id: http://core.svn.wordpress.org/trunk@53094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a new parameter to `WP_Query` called `update_menu_item_cache` that when set to true, primes the caches for linked terms and posts for menu item post objects. This change moves logic
found in `wp_get_nav_menu_items` into a new function called `update_menu_item_cache`. Update the menu item REST API controller, to pass the `update_menu_item_cache` parameter to the
arguments used for the `WP_Query` run to get menu items.
Props furi3r, TimothyBlynJacobs, spacedmonkey, peterwilsoncc, mitogh.
Fixes#55620.
--This line, and those below, will be ignored--
M src/wp-includes/class-wp-query.php
M src/wp-includes/nav-menu.php
M src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
M tests/phpunit/tests/post/nav-menu.php
Built from https://develop.svn.wordpress.org/trunk@53504
git-svn-id: http://core.svn.wordpress.org/trunk@53093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
That allows locales to switch the order of the first name and last name, should they prefer to do so.
The string was previously used in `wp_insert_user()` and is now reused in other places for consistency:
* `WP_MS_Users_List_Table::column_name()`
* `WP_Users_List_Table::column_name()`
* `wp_list_authors()`
* `wp_list_users()`
Note: This also removes the `wp_list_author_full_name` filter, introduced for the same purpose in `wp_list_authors()`, as redundant for now.
Follow-up to [53486].
See #17025.
Built from https://develop.svn.wordpress.org/trunk@53501
git-svn-id: http://core.svn.wordpress.org/trunk@53090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The test bootstrap requires GD to be available, so this test skip condition will never be matched.
Also, test skipping from within a helper method, which may be used in a data provider, can lead to test runtime errors.
Follow-up to [49009], [49014], [49535], [49571], [51415].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53497
git-svn-id: http://core.svn.wordpress.org/trunk@53086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduced [52836] when passing `child_of` or `pad_counts` parameters to `get_terms` or `WP_Term_Query` class, the array of terms received by the query, was not correctly cached. This
change simplifies the logic in `WP_Term_Query` and ensures terms are correctly cached. This change also, improves performance, by only caching an array of term ids where possible.
Props denishua, spacedmonkey, oztaser, peterwilsoncc, SergeyBiryukov, georgestephanis, jnz31, knutsp, mukesh27, costdev.
Fixes#55837.
Built from https://develop.svn.wordpress.org/trunk@53496
git-svn-id: http://core.svn.wordpress.org/trunk@53085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Move a non-test specific helper function used by multiple tests up to the top of the class to make it more easily discoverable.
* Move a test-specific helper function used by only one test to be directly below the test using the helper function and make the link with the test explicit by adding a `@see` tag.
Follow-up to [1201/tests], [51415].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53495
git-svn-id: http://core.svn.wordpress.org/trunk@53084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `wp_user_settings()` function calls the PHP native `setcookie()` function, the fifth parameter of which is the ''optional'' `$domain` 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 `setcookie(): Passing null to parameter #5 ($domain) of type string is deprecated` notice.
Changing the `null` to an empty string fixes this without a backward compatibility break.
References:
* [https://www.php.net/manual/en/function.setcookie.php PHP Manual: setcookie()]
* [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 [29478].
Props ocean90, shenyanzhi, meysamnorouzi, jrf.
Fixes#54914.
Built from https://develop.svn.wordpress.org/trunk@53490
git-svn-id: http://core.svn.wordpress.org/trunk@53079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset introduces the `wp_list_author_full_name` hook to allows developers to filter author full name, which by default is a combinaison of the author first and last name, separated by a space.
Props kevinB, wonderboymusic, DrewAPicture, nacin, Mte90, jorbin, afercia, rafiahmedd.
Fixes#17025.
Built from https://develop.svn.wordpress.org/trunk@53486
git-svn-id: http://core.svn.wordpress.org/trunk@53075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Make the descriptions for `update_post_author_caches()` and `update_post_caches()` more specific.
* Move the unit test into its own file, for consistency with `update_post_cache()` tests. This also allows for using shared fixtures in case more tests are added in the future.
Follow-up to [53482].
See #55716.
Built from https://develop.svn.wordpress.org/trunk@53483
git-svn-id: http://core.svn.wordpress.org/trunk@53072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
For a call to `WP_Query` or a post REST API request that contains posts from multiple authors, call the `cache_users` function, to ensure that all user data for post authors is primed in
a single database query. This results in far fewer database queries on multiple author sites.
Props spacedmonkey, timothyblynjacobs, peterwilsoncc.
Fixes#55716.
Built from https://develop.svn.wordpress.org/trunk@53482
git-svn-id: http://core.svn.wordpress.org/trunk@53071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add a `@since` note for the `decoding` attribute in `wp_get_attachment_image()`.
* Adjust `wp_img_tag_add_decoding_attr()` DocBlocks per the documentation standards.
* Wrap some long `sprintf()` calls in unit tests for better readability. In at least one case, `the_content` was unnecessarily passed to `sprintf()` as an extra (unused) parameter.
Follow-up to [53480].
See #53232.
Built from https://develop.svn.wordpress.org/trunk@53481
git-svn-id: http://core.svn.wordpress.org/trunk@53070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamically add `decoding="async"` to image tags on the front end of a site to instruct browsers to download them in parallel.
Modifies `wp_get_attachment_image()`, `get_avatar()` to include the attribute by default. Modifies `wp_filter_content_tags()` to add the attribute during the front-end render of the site.
Introduces `wp_img_tag_add_decoding_attr()` to take an image tag and modify it to include the attribute. Introduces the filter `wp_img_tag_add_decoding_attr` used to define the default value for the attribute.
Props adamsilverstein, ayeshrajans, costdev, flixos90, hellofromtonya, isaumya, michaelbourne, mihai2u, mitogh, sergiomdgomes, spacedmonkey, westonruter, peterwilsoncc.
Fixes#53232.
Built from https://develop.svn.wordpress.org/trunk@53480
git-svn-id: http://core.svn.wordpress.org/trunk@53069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This change fixes an alignement issue on the "Wide Line" Separator style variation on front-end, especially when used inside a column block. It changes the block `width` value from `120rem` to `100%` to avoid container overflowing.
Props kjellr, matthiaspabst, sabernhardt, audrasjb.
Fixes#53643.
Built from https://develop.svn.wordpress.org/trunk@53475
git-svn-id: http://core.svn.wordpress.org/trunk@53064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Twenty Twenty's `style.css` file has `/*rtl:ignore*/` for the `.has-text-align-left` class, but that was previously missing from the `.has-text-align-right` class. As a result, the theme overrides block library styles on the front-end (and not in the editor). This changeset adds the missing declaration.
Props amirkamizi, mayankmajeji, ianbelanger, sabernhardt, hasanuzzamanshamim.
Fixes#49447.
Built from https://develop.svn.wordpress.org/trunk@53471
git-svn-id: http://core.svn.wordpress.org/trunk@53060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset updates the `font-style` value of the Quote block in the block editor to ensure styles are consistent between the editor and the front-end.
Props kajalgohel, iamjaydip, audrasjb, whaze, mukesh27.
Fixes#55931.
Built from https://develop.svn.wordpress.org/trunk@53470
git-svn-id: http://core.svn.wordpress.org/trunk@53059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When searching for previous workflow runs by branch, GitHub currently includes matches within forks.
If a contributor opens a pull request from their fork with a `head_ref` matching a Core branch that triggers a workflow on `push` event, the outcomes of the workflows associated with that pull request are currently used to determine if the previous workflow run had failed.
The result is a false “fixed” notifications when a commit immediately follows a failed workflow run from the pull request.
This adds a check to skip any workflow runs not triggered by a `push` event to prevent these inaccurate notifications.
Props SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53466
git-svn-id: http://core.svn.wordpress.org/trunk@53055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
If the path starts with a slash, it will be considered absolute and returned as is earlier in the function.
It it's not absolute, then it does not start with a slash, so there is nothing to trim.
This change is covered by existing unit tests.
Follow-up to [6984], [53457].
Props karlijnbk.
See #55897.
Built from https://develop.svn.wordpress.org/trunk@53460
git-svn-id: http://core.svn.wordpress.org/trunk@53049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to improve performance by calling `sanitize_url()` directly, instead of the `esc_url_raw()` wrapper. As of WordPress 6.1, `sanitize_url()` is the recommended function for sanitizing a URL for database or redirect usage.
Follow-up to [11383], [13096], [51597], [53452].
Props benjgrolleau, peterwilsoncc, SergeyBiryukov.
Fixes#55852.
Built from https://develop.svn.wordpress.org/trunk@53455
git-svn-id: http://core.svn.wordpress.org/trunk@53044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a test failure if the `ZipArchive` class is missing.
Additionally, this commit replaces an inline check for the `ZipArchive` class in personal data export file tests with a `@requires` annotation, for consistency with similar PHP extension requirements in other tests.
Follow-up to [44786], [51415], [52286].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53454
git-svn-id: http://core.svn.wordpress.org/trunk@53043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A general security rule is "Sanitize when you save, escape when you echo".
In WordPress 5.9, `sanitize_url()` was un-deprecated in order to better align with the naming of other sanitizing functions, while still being an alias for `esc_url_raw()`.
This commit reverses the order and turns `esc_url_raw()` into a wrapper for `sanitize_url()`, making the latter the canonical function call and aiming to improve performance by reducing the number of function calls required when using the recommended technique.
Follow-up to [11383], [13096], [51597].
Props benjgrolleau, peterwilsoncc, SergeyBiryukov.
See #55852.
Built from https://develop.svn.wordpress.org/trunk@53452
git-svn-id: http://core.svn.wordpress.org/trunk@53041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, setting the `show_in_quick_edit` property to `false` removed the taxonomy from the inline edit form, but several taxonomy-related database queries were still being performed in `bulk_edit_posts()` when building the arguments to pass to `wp_update_post()`, even though terms were not modified.
This commit improves performance by avoiding unnecessary database queries when `show_in_quick_edit` is `false`, and mirrors a similar check in the `get_inline_data()` function.
Follow-up to [13535], [14580], [31307], [52841], [53368].
Props Chouby, sabernhardt, costdev, nalininonstopnewsuk, webcommsat, marybaum, meher, wparslan, SergeyBiryukov.
Fixes#42474.
Built from https://develop.svn.wordpress.org/trunk@53449
git-svn-id: http://core.svn.wordpress.org/trunk@53038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
No functional changes were made to Twenty Ten during the WordPress 6.0 release cycle so the theme version bump is not needed. The "tested up to" header change is maintained.
Follow up to and partial revert of [53418].
Props desrosj, ravipatel, costdev.
Fixes#55810.
See #55754.
Built from https://develop.svn.wordpress.org/trunk@53448
git-svn-id: http://core.svn.wordpress.org/trunk@53037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Append `?ver=6.0` to the image used for linking to the video to break the cache in browsers, proxy servers and on the CDN.
A new version of the image has been uploaded and replaced the file in the original location.
Props annezazu, critterverse, ryelle, costdev, ironprogrammer, dd32.
Fixes#55808.
Built from https://develop.svn.wordpress.org/trunk@53447
git-svn-id: http://core.svn.wordpress.org/trunk@53036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes an `Equals sign not aligned correctly` WPCS warning.
Additionally, this commit sets the `svn:eol-style` property for the `phpunit/tests/ajax/wpAjaxCropImage.php` file and corrects line endings, so that the output of `composer format` is clean.
Follow-up to [53027], [53217], [53404].
Props hellofromTonya, SergeyBiryukov.
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53441
git-svn-id: http://core.svn.wordpress.org/trunk@53030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
MariaDB 10.2 has reached EOL in May 2022. The recommended minimum is bumped to 10.3 for now.
Follow-up to [52319], [52358], [52420], [52424], [53431], [53433], [meta11866].
Props hellofromTonya.
Fixes#55791. See #meta6322.
Built from https://develop.svn.wordpress.org/trunk@53435
git-svn-id: http://core.svn.wordpress.org/trunk@53024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The odd / even class attribute global variables are causing issues in comments tests when a new test is added or an existing test is modified. To stabilize the odd / even comment tests, the comment global variables are added to the base test class' `tear_down()` using the same patterns as the other global resets. This change ensures each comment test starts at the same state. In doing so, the expected odd / even class attributes are no longer affected by previous tests, i.e. test leaks.
Follow-up to [53172].
Props hellofromTonya, zieladam, peterwilsoncc.
See #54725.
Built from https://develop.svn.wordpress.org/trunk@53430
git-svn-id: http://core.svn.wordpress.org/trunk@53019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a PHP fatal error if any of these functions are called too early:
* `have_posts()`
* `in_the_loop()`
* `rewind_posts()`
* `the_post()`
* `have_comments()`
* `the_comment()`
bringing some consistency with conditional tags: `is_single()`, `is_home()`, etc.
This commit also removes unnecessary `return` from `the_comment()`, for consistency with `the_post()`. As `WP_Query::the_comment()` does not have a return value, this statement did not have any effect in practice.
Follow-up to [4934], [8807], [16947], [17068], [17083], [49147], [53395], [53396], [53400].
Props vdankbaar, thijso, teunvgisteren, timkersten655, SergeyBiryukov.
Fixes#55722.
Built from https://develop.svn.wordpress.org/trunk@53429
git-svn-id: http://core.svn.wordpress.org/trunk@53018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This adjusts the workflow run URLs included in Slack notifications to link to the specific attempt being reported on making it easier for someone to see the proper context of a specific notification.
Additionally, this eliminates the need for a contributor to share the reason for a failure in Slack before restarting the workflow, as the link will always be to that specificattempt. When a “fixed” notification occurs for a subsequent run attempt, the link will be to the new, successful run attempt.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53427
git-svn-id: http://core.svn.wordpress.org/trunk@53016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`phpversion()` return value and `PHP_VERSION` constant value are identical, but the latter is several times faster because it is a direct constant value lookup compared to a function call.
Props ayeshrajans, jrf, mukesh27, costdev, hellofromTonya, SergeyBiryukov.
Fixes#55680.
Built from https://develop.svn.wordpress.org/trunk@53426
git-svn-id: http://core.svn.wordpress.org/trunk@53015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Bump bundled theme version numbers in preparation for the WordPress 6.0 release. Each theme's _tested up to_ file header has been increased to indicate WordPress 6.0 support.
The new version numbers are:
* Twenty Ten: 3.7
* Twenty Eleven: 4.1
* Twenty Twelve: 3.7
* Twenty Thirteen*: 3.7
* Twenty Fourteen: 3.4
* Twenty Fifteen*: 3.2
* Twenty Sixteen*: 2.7
* Twenty Seventeen*: 3.0
* Twenty Nineteen: 2.3
* Twenty Twenty: 2.0
* Twenty Twenty-One: 1.6
An asterisk indicates the theme includes assets requiring a manual version bump, this is set to the reverse date format of the release day: `20220524`.
Follow up to [53286] in which the Twenty Twenty-Two theme version was bumped to 1.2.
Props peterwilsoncc, desrosj, costdev, mehedi890.
Fixes#55754.
Built from https://develop.svn.wordpress.org/trunk@53418
git-svn-id: http://core.svn.wordpress.org/trunk@53007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Updates theme validation to accept block themes. This replaces the requirement for an `index.php` with a requirement for either an `index.php`, `/templates/index.html` or the deprecated `/block-templates/index.html`.
Validation is updated for theme uploads, within `WP_Theme::__construct` and `validate_current_theme()`.
A block theme using the deprecated file structure is now included in the unit tests.
Props peterwilsoncc, sergeybiryukov, hellofromtonya, costdev, azaozz, gziolo, FlorianBrinkmann, Boniu91, aristath, poena, audrasjb.
Fixes#55754.
Built from https://develop.svn.wordpress.org/trunk@53416
git-svn-id: http://core.svn.wordpress.org/trunk@53005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The element already has non-visual text, making the icon and the `title` attribute redundant for assistive technologies.
Follow-up to [22439], [27548], [31513], [32991], [50804].
Props sabernhardt, ryokuhi, afercia, karlgroves, SergeyBiryukov.
Fixes#55555. See #24766.
Built from https://develop.svn.wordpress.org/trunk@53414
git-svn-id: http://core.svn.wordpress.org/trunk@53003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When redirecting the site editor to the home template include the `style` querystring parameter if it is set. This ensures the style panel opens if the user expects it.
Props grantmkin, mamaduka, peterwilsoncc.
Fixes#55752.
Built from https://develop.svn.wordpress.org/trunk@53413
git-svn-id: http://core.svn.wordpress.org/trunk@53002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids an `Undefined array key 0` PHP warning for `current_user_can()` capability checks that require a specific object to check against but an object ID was not passed.
A `_doing_it_wrong()` notice is also added, so that developers and site administrators are aware that the capability mapping is failing in the absence of the required object ID.
The list of mapped capabilities that require an object ID:
* `delete_post` / `delete_page`
* `edit_post` / `edit_page`
* `read_post` / `read_page`
* `publish_post`
* `edit_(post|comment|term|user)_meta` / `delete_*_meta` / `add_*_meta`
* `edit_comment`
* `edit_term` / `delete_term` / `assign_term`
Follow-up to [34091], [34113], [47178].
Props jeherve, peterwilsoncc, henry.wright, johnbillion, mattheweppelsheimer, hellofromTonya, JeffPaul, azouamauriac, Ninos Ego, TobiasBg, wpsmith, GaryJ, nacin, johnstonphilip, azaozz, SergeyBiryukov.
Fixes#44591.
Built from https://develop.svn.wordpress.org/trunk@53408
git-svn-id: http://core.svn.wordpress.org/trunk@52997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When called too early, conditional query tags should throw a `_doing_it_wrong()` notice and return `false`. This commit verifies that behavior not only for `is_main_query()`, but for all the other conditional tags too.
Follow-up to [16947], [17068], [17083], [18699], [37985], [53395].
See #55104.
Built from https://develop.svn.wordpress.org/trunk@53396
git-svn-id: http://core.svn.wordpress.org/trunk@52985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a PHP fatal error and triggers a `_doing_it_wrong()` notice if `is_main_query()` is called too early, bringing consistency with all the other `is_*()` conditionals: `is_single()`, `is_home()`, etc.
Follow-up to [16947], [17068], [17083], [18699], [37985].
Props vdankbaar, nhadsall, johnbillion, costdev, thijsoo, teunvgisteren, timkersten655, SergeyBiryukov.
Fixes#55104.
Built from https://develop.svn.wordpress.org/trunk@53395
git-svn-id: http://core.svn.wordpress.org/trunk@52984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This replaces the references to “MySQL” with “your host’s database server” on the “Error establishing a database connection” page when Multisite could not be loaded. The generic “database server” term can refer to MySQL or MariaDB. Additionally, this brings some consistency with a similar error message in `wpdb::db_connect()`.
Follow-up to [52367], [52423].
Props tj692, hansjovisyoast, tobifjellner.
Fixes#55701.
Built from https://develop.svn.wordpress.org/trunk@53394
git-svn-id: http://core.svn.wordpress.org/trunk@52983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Backport of the remaining Comment Template block tests from Gutenberg:
* `assertEquals()` replaced with `assertSameSetsWithIndex()`.
* assertion's argument order changed to ensure expected and then actual.
Follow-up to [53353], [53298], [53172], [53138].
Props bernhard-reiter.
Fixes#55708.
Built from https://develop.svn.wordpress.org/trunk@53388
git-svn-id: http://core.svn.wordpress.org/trunk@52977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is a defensive coding measure that aims to reduce confusion. With this change, `$pieces` is explicitly used for the names, and `$clauses` for the values of the clauses.
Follow-up to [52974], [53175], [53370], [53375].
Props peterwilsoncc.
See #55699.
Built from https://develop.svn.wordpress.org/trunk@53376
git-svn-id: http://core.svn.wordpress.org/trunk@52965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is a defensive coding measure that aims to reduce confusion. With this change, `$pieces` is explicitly used for the names, and `$clauses` for the values of the clauses.
Follow-up to [52974], [53175], [53370].
Props peterwilsoncc.
See #55699.
Built from https://develop.svn.wordpress.org/trunk@53375
git-svn-id: http://core.svn.wordpress.org/trunk@52964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replace error suppressing in `wp_filesize()` with a `file_exists()` check before calling the native PHP `filesize()` function.
Follow up to [52837].
Props Cybr, johnbillion, spacedmonkey, antpb, azouamauriac, ironprogrammer, mukesh27, costdev, audrasjb, dlh.
Fixes#55678.
See #49412.
Built from https://develop.svn.wordpress.org/trunk@53372
git-svn-id: http://core.svn.wordpress.org/trunk@52961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since this is an admin template function and the tests check for specific output with certain taxonomy parameters, placing the tests along with other tests for the functions in the same file should make them easier to find and extend than when placed between general taxonomy registration tests.
Follow-up to [52841], [53368].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53371
git-svn-id: http://core.svn.wordpress.org/trunk@52960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses a backward compatibility break where `posts_join_request` and other filters were applied, but their results were subsequently discarded and earlier values were used instead.
Follow-up to [52974], [53175].
Props 5um17, johnbillion, SergeyBiryukov.
Fixes#55699.
Built from https://develop.svn.wordpress.org/trunk@53370
git-svn-id: http://core.svn.wordpress.org/trunk@52959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Additional tests to ensure taxonomies show in the quick/bulk edit froms based on the `show_in_quick_edit` setting rather than the the `show_ui` setting.
Follow up to [52841,31307].
Props figureone, costdev, audrasjb.
Fixes#49701.
Built from https://develop.svn.wordpress.org/trunk@53368
git-svn-id: http://core.svn.wordpress.org/trunk@52957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that parameter names for PHP polyfills in WordPress core 100% match the native PHP parameter names. Otherwise using named parameters with those functions could cause fatal errors for installs where the polyfills kick in.
This commit:
* Renames the `$string` parameter to `$message` in `_()` polyfill.
* Renames the `$str` parameter to `$string` in `mb_substr()` and `mb_strlen()` polyfills.
* Renames the `$raw_output` parameter to `$binary` in `hash_hmac()` polyfill.
* Renames the `$a` and `$b` parameters to `$known_string` and `$user_string` in `hash_equals()` polyfill.
* Renames the `$var` parameter to `$value` in `is_countable()` and `is_iterable()` polyfills.
* Renames the `$arr` parameter to `$array` in `array_key_first()` and `array_key_last()` polyfills.
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].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55650.
Built from https://develop.svn.wordpress.org/trunk@53365
git-svn-id: http://core.svn.wordpress.org/trunk@52954 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_page` in `parent_dropdown()`.
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].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55650.
Built from https://develop.svn.wordpress.org/trunk@53364
git-svn-id: http://core.svn.wordpress.org/trunk@52953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Restore behaviour of `fields` parameter in `WP_User_Query` to allow developers to specify any database field to be returned either individually or as part of a subset. Add these fields to the documentation.
When a subset of `fields` includes the `id` paramater, include it in the results in both upper and lowercase to maintain backward compatibility.
Follow up to [53327].
Props dd32, pbearne, kraftbj, peterwilsoncc.
Fixes#53177.
Built from https://develop.svn.wordpress.org/trunk@53362
git-svn-id: http://core.svn.wordpress.org/trunk@52951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevent concatenation of scripts if the text domain is defined to ensure the dependency order is respected.
This accounts for an edge case in which replacing a core script via a plugin and a lack of translations (eg, for a US English site) could cause the JavaScript files to be ordered incorrectly.
Follow up to [52937].
Props audrasjb, boniu91, chaion07, costdev, hellofromtonya, jsnajdr, mukesh27, ndiego, ugyensupport.
Fixes#55628.
Built from https://develop.svn.wordpress.org/trunk@53360
git-svn-id: http://core.svn.wordpress.org/trunk@52949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `amd64/mysql` and `amd64/mariadb` official images from Docker are compatible with x86 running on the ARM64v8 architecture of M1 machines.
Props afragen, justinahinon, desrosj, talldanwp, antonvlasenko, gziolo, aristath, johnbillion
Fixes#52356
Built from https://develop.svn.wordpress.org/trunk@53358
git-svn-id: http://core.svn.wordpress.org/trunk@52947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Backport of 2 tests from Gutenberg for the Comment Template block:
* test line and paragraph breaks are converted into HTML tags.
* test rendering of unapproved comment preview.
Follow-up to [53298], [53172], [53138].
Props bernhard-reiter, darerodz, gziolo, peterwilsoncc, hellofromTonya.
Fixes#55643.
See #55634.
Built from https://develop.svn.wordpress.org/trunk@53353
git-svn-id: http://core.svn.wordpress.org/trunk@52942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Rename `#inline-edit-legend` to avoid duplicate HTML IDs. These have been renamed `#quick-edit-legend` and `#bulk-edit-legend` for the quick and bulk editors respectively.
This HTML ID is not required by the quick editor duplicated via JavaScript so is removed as part of the duplication process.
Follow up to [53096].
Props azaozz, costdev, greglone, hellofromtonya, ironprogrammer, joedolson, sabernhardt.
Fixes#55575.
See #35483.
Built from https://develop.svn.wordpress.org/trunk@53352
git-svn-id: http://core.svn.wordpress.org/trunk@52941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that `WP_UnitTestCase::skipOnAutomatedBranches()` has access to the `GITHUB_REF` and `GITHUB_EVENT_NAME` variables, so that some tests can be skipped when appropriate.
Additionally, account for renaming the `master` branch to `trunk` in November 2021.
Follow-up to [40241], [46999], [49264], [49267], [51868].
Fixes#55668.
Built from https://develop.svn.wordpress.org/trunk@53349
git-svn-id: http://core.svn.wordpress.org/trunk@52938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
After subtracing `0.1` from a `X.1` current version, the result was a single digit without the `.0` decimal. Using `number_format()` ensures each current version has a decimal before appending the `.x` before the test.
This commit also reverts [55346] which was a temporary workaround.
Follow-up to [55346], [47403].
Fixes#55667.
Built from https://develop.svn.wordpress.org/trunk@53347
git-svn-id: http://core.svn.wordpress.org/trunk@52936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is the start of the WordPress 6.0 about page, introducing new content and a first pass of the new style.
Props fcoveram, estelaris, JeffPaul, critterverse, chanthaboune, dansoschin, webcommsat, annezazu, marybaum, cbringmann, eidolonnight, laurlittle, sergeybiryukov.
See #55434.
Built from https://develop.svn.wordpress.org/trunk@53339
git-svn-id: http://core.svn.wordpress.org/trunk@52928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A SQL syntax error happened when a post has no comments and "Break comments into pages" is checked in Settings > Discussion. The fix sets the `'paged'` query arg only when there are comments. When there are no comments, `WP_Comment_Query` sets the default `'paged'` value to `1`.
Props bernhard-reiter, luisherranz, czapla, cbravobernal, davidbaumwald, hellofromTonya.
Follow-up to [53142], [53138].
Fixes#55658.
Built from https://develop.svn.wordpress.org/trunk@53336
git-svn-id: http://core.svn.wordpress.org/trunk@52925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[53218] introduced a bug of a wrong response from the `wp/v2/pattern-directory/patterns` endpoint with a `slug` parameter. As the response is cached, it can result in an incorrect list of available patterns supported by the current theme.
This commit resolves by:
* Limiting the `slug` to an `array` in the query parameters.
* When set, parsing and sorting the slug(s) and then serializing the sorted query args as part of the hashed transient keys.
Props antonvlasenko, timothyblynjacobs, spacedmonkey, costdev, hellofromTonya.
Follow-up to [53218], [53152], [51208].
Fixes#55617.
Built from https://develop.svn.wordpress.org/trunk@53333
git-svn-id: http://core.svn.wordpress.org/trunk@52922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improve validation of `WP_User_Query`'s `fields` argument when passed as an array to ensure it only accepts permitted values. This prevents the invalid values being included in the generated database query.
Expand unit tests to include passing invalid values as part of an array, the lower case value `id`. Correct earlier unit tests to limit database query to one result.
Follow up to [53255].
Props felipeelia.
Fixes#53177.
Built from https://develop.svn.wordpress.org/trunk@53327
git-svn-id: http://core.svn.wordpress.org/trunk@52916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset ensures third-person singular verbs are used for function descriptions in the `Walker` class, and adjusts some non-standard docblock descriptions for various properties and methods of the class.
See #54729.
Built from https://develop.svn.wordpress.org/trunk@53323
git-svn-id: http://core.svn.wordpress.org/trunk@52912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Follow-up for #51491.
Updating WordPress packages is currently a manual process that takes some reading and trial & error to figure out. This PR adds a single npm task called `sync-gutenberg-packages` that automates this entire process.
Props zieladam.
Fixes#55642.
Built from https://develop.svn.wordpress.org/trunk@53311
git-svn-id: http://core.svn.wordpress.org/trunk@52900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Ensure that empty values of include and exclude passed to the parameters of `WP_Term_Query`, reused existing caches by
resetting values to an empty array.
Props Spacedmonkey, peterwilsoncc, hellofromtonya.
Follow-up to [52970].
See #55352.
Built from https://develop.svn.wordpress.org/trunk@53309
git-svn-id: http://core.svn.wordpress.org/trunk@52898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Bypass checking `theme.json` for web fonts during the installation of WordPress.
During installation the active theme is considered to be Twenty Twenty-Two (the default theme). As a block theme this prompts a database call when the web fonts API checks the `theme.json` settings, this triggers a database error during installation as the database tables do not exist.
Props chouby, costdev, peterwilsoncc, sergeybiryukov.
Fixes#55632.
Built from https://develop.svn.wordpress.org/trunk@53306
git-svn-id: http://core.svn.wordpress.org/trunk@52895 1a063a9b-81f0-0310-95a4-ce76da25c4cd