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 group of test files, the test classes contain a `set_up()` method which sets a few dynamic (not explicitly declared) properties.
For those properties which were set using a function call or variable access, the property has been explicitly declared on the class now.
For those properties which were set using a constant scalar expression and for which the value is not changed by any of the tests, the property setting has been removed in favor of declaring a class constant.
Includes removing one unused dynamic property declaration: `$this->queries` in `Test_Block_Supports_Layout`, which appears to be a copy/paste from `Tests_Theme_wpThemeJsonResolver`.
Follow-up to [40/tests], [260/tests], [598/tests], [50960], [52675], [53085], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856].
Props jrf.
See #56033.
git-svn-id: https://develop.svn.wordpress.org/trunk@53916 602fd350-edb4-49c9-b593-d223f7449a82
The function to check whether WordPress is not installed has evolved over time, ending up with duplicate conditionals.
This commit combines two conditionals into a single one and includes an early return.
Follow-up to [672], [676], [725], [1184], [1401], [1980], [2171], [2467], [2468], [2486], [2703], [3011], [3670], [12688], [12732], [12762], [13253], [29599], [30581], [34828].
See #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53915 602fd350-edb4-49c9-b593-d223f7449a82
This is a micro-optimization that makes the conditional several times faster for non-deprecated options by avoiding an unnecessary function call.
Functions affected:
* `get_option()`
* `update_option()`
* `add_option()`
Follow-up to [48575].
See #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53914 602fd350-edb4-49c9-b593-d223f7449a82
Use `aria-describedby` to associate the field descriptions and instructions with the form fields when creating or editing taxonomy terms.
Props afercia.
Fixes#55651.
git-svn-id: https://develop.svn.wordpress.org/trunk@53913 602fd350-edb4-49c9-b593-d223f7449a82
Add `aria-label` and `aria-describedby` to provide embed form fields with accessible names and ensure each embed has a unique ID attribute to prevent duplicate IDs.
Props afercia, swissspidy.
Fixes#55664.
git-svn-id: https://develop.svn.wordpress.org/trunk@53912 602fd350-edb4-49c9-b593-d223f7449a82
Change the notification announced when a custom structure is removed. Previously, the notification incorrectly indicated that the structure was added for both actions. This changes the notification to correctly announce removals when structures are removed.
Props joedolson, kebbet, SergeyBiryukov.
Fixes#56230.
git-svn-id: https://develop.svn.wordpress.org/trunk@53911 602fd350-edb4-49c9-b593-d223f7449a82
This affects:
* `WP_Test_REST_Categories_Controller`
* `WP_Test_REST_Comments_Controller`
* `WP_Test_REST_Tags_Controller`
and brings consistency with:
* `WP_Test_REST_Posts_Controller`
* `WP_Test_REST_Users_Controller`
These test classes were previously updated to improve performance by creating less fixtures and reusing them where possible. While the pagination tests for categories and comments still passed due to enough items being created, the pagination test for tags did not work as expected and did not perform any assertions due to trying to iterate over an empty array of results.
This is now corrected by assigning the properties as intended and adding more assertions to the affected test.
Follow-up to [46657].
Props johnregan3, costdev, johnbillion.
See #54662.
git-svn-id: https://develop.svn.wordpress.org/trunk@53909 602fd350-edb4-49c9-b593-d223f7449a82
This better matches the tab name and changes the associated action hooks to:
* `install_themes_pre_block-themes` (fires before the tab is rendered)
* `install_themes_block-themes` (fires at the top the tab)
While including a mix of underscores and hyphens in a hook name is not quite typical for core, it does have a precedent and brings more consistency with similar filters on Add Plugin screen:
* `install_plugins_pre_plugin-information`
* `install_plugins_plugin-information`
Follow-up to [53906], [53907].
Fixes#56283.
git-svn-id: https://develop.svn.wordpress.org/trunk@53908 602fd350-edb4-49c9-b593-d223f7449a82
Alphabetize the list of possible hook name in `install_themes_pre_*` and `install_themes_*` filters.
Follow-up to [53906].
See #56283.
git-svn-id: https://develop.svn.wordpress.org/trunk@53907 602fd350-edb4-49c9-b593-d223f7449a82
The Theme Directory on wordpress.org recently got updated to show a shortcut for filtering block themes. This changeset adds a "Block Themes" filter when adding a new theme from WordPress administration.
It also introduces two new action hooks: `install_themes_pre_blockthemes` (fires before the tab is rendered) and `install_themes_blockthemes` (fires at the top the tab).
Follow-up to [meta11963].
Props luminuu, audrasjb, SergeyBiryukov, rafiahmedd.
Fixes#56283.
See #meta6330.
git-svn-id: https://develop.svn.wordpress.org/trunk@53906 602fd350-edb4-49c9-b593-d223f7449a82
A default DNS prefetch entry for s.w.org was previously included to save a few ms in case an emoji is used that is not supported by the browser. It appears this use case doesn't justify a prefetch to s.w.org on every WordPress website.
This changesets removes `emoji_svg_url` prefetch from `wp_resource_hints()`. It also updates unit tests in `Tests_General_wpResourceHints` by removing `test_should_have_defaults_on_frontend()` entirely and removing s.w.org prefetch from expected output of ten other test functions.
Plugin authors can use the `wp_resource_hints` filter if they need to re-add the DNS prefetch entry for s.w.org.
Follow-up to [37920], [38122].
Props joelhardi, superpoincare, jhabdas, garrett-eclipse, sabernhardt, SergeyBiryukov.
Fixes#40426.
See #37387.
git-svn-id: https://develop.svn.wordpress.org/trunk@53904 602fd350-edb4-49c9-b593-d223f7449a82
This takes into account plugin or theme test suites that rely on `WP_PLUGIN_DIR` being set to a custom path.
Follow-up to [49236], [49269], [49566], [53874].
Props aaemnnosttv, flixos90.
Fixes#39210.
git-svn-id: https://develop.svn.wordpress.org/trunk@53902 602fd350-edb4-49c9-b593-d223f7449a82
This addresses an error on MySQL 8.0.22 or later:
{{{
Character set 'utf8mb4_unicode_520_ci' cannot be used in conjunction with 'binary' in call to regexp_like
}}}
From the [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-22.html MySQL 8.0.22 changelog]:
> Regular expression functions such as `REGEXP_LIKE()` yielded inconsistent results with binary string arguments. These functions now reject binary strings with an error. ([https://bugs.mysql.com/bug.php?id=98951 Bug #98951], [https://bugs.mysql.com/bug.php?id=98950 Bug #98950])
WordPress meta queries use the `BINARY` data type for case-sensitive meta key comparisons using regular expressions. By explicitly casting the meta key to `BINARY`, we can make sure the values being compared use the same character set and produce consistent results.
The change is covered by existing meta query unit tests: three tests which previously failed on MySQL 8.0.22 or later now pass.
References:
* [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-22.html MySQL 8.0.22 changelog]
* [https://bugs.mysql.com/bug.php?id=104387 Bug #104387 CHARACTER_SET_MISMATCH issue with regex comparisons]
Follow-up to [46188].
Fixes#51740.
git-svn-id: https://develop.svn.wordpress.org/trunk@53901 602fd350-edb4-49c9-b593-d223f7449a82
When extracting the email and name from a “From” header, the last character of the name is incorrectly trimmed when a space is not included between the name and the opening `<`.
Though the space is required for the header to be compliant with RFC5322 (see https://www.rfc-editor.org/rfc/rfc5322#section-3.4), the absence of a space can be ignored here. PHPMailer accepts the name and email as separate parameters and constructs the header correctly later on.
Props hakanca, mikehansenme, SergeyBiryukov, kovshenin, mattyrob, drewapicture, desrosj.
Fixes#19847.
git-svn-id: https://develop.svn.wordpress.org/trunk@53900 602fd350-edb4-49c9-b593-d223f7449a82
This ensures updates for all 3rd party actions will be flagged when updates exist simultaneously.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53899 602fd350-edb4-49c9-b593-d223f7449a82
While `WP_Filesystem_Base::size()` is documented to return `false` on failure, `ftp_size()` returns -1, and the method documentation was recently updated to reflect that.
This commit restores the previous `@return` tag and corrects the actual return value instead, to bring consistency with all the other `WP_Filesystem_*::size()` methods:
* `WP_Filesystem_Base::size()`
* `WP_Filesystem_Direct::size()`
* `WP_Filesystem_ftpsockets::size()`
* `WP_Filesystem_SSH2::size()`
{{{
@return int|false Size of the file in bytes on success, false on failure.
}}}
This better matches the purpose of the API to provide a consistent interface for various filesystem implementations.
Follow-up to [6779], [30678], [45226], [53860], [53862].
Fixes#51170.
git-svn-id: https://develop.svn.wordpress.org/trunk@53898 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53897 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53896 602fd350-edb4-49c9-b593-d223f7449a82
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
git-svn-id: https://develop.svn.wordpress.org/trunk@53895 602fd350-edb4-49c9-b593-d223f7449a82
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
git-svn-id: https://develop.svn.wordpress.org/trunk@53893 602fd350-edb4-49c9-b593-d223f7449a82
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
git-svn-id: https://develop.svn.wordpress.org/trunk@53891 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53890 602fd350-edb4-49c9-b593-d223f7449a82
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 [37357], [44478].
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53889 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53888 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds support for Enums in `is_serialized()`. It also adds new unit tests for this function.
Props ayeshrajans, konradyoast, peterwilsoncc, costdev, dennisatyoast, mukesh27.
Fixes#53299.
git-svn-id: https://develop.svn.wordpress.org/trunk@53886 602fd350-edb4-49c9-b593-d223f7449a82
Prime the parent post objects `wp_ajax_query_attachments()` to reduce the number of database queries in the query-attachments admin-ajax endpoint.
Props albatross10.
Fixes#56037.
git-svn-id: https://develop.svn.wordpress.org/trunk@53885 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53884 602fd350-edb4-49c9-b593-d223f7449a82
This prevents existing category relationships being overridden with the default category when none is provided in the post data.
Props markoheijnen, leewillis77, desrosj
Fixes#19954
git-svn-id: https://develop.svn.wordpress.org/trunk@53883 602fd350-edb4-49c9-b593-d223f7449a82
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
git-svn-id: https://develop.svn.wordpress.org/trunk@53882 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53880 602fd350-edb4-49c9-b593-d223f7449a82
Removing these code tags means the function name will be automatically linked on the developer.wordpress.org reference, which is more useful than just seeing the function name.
See #55646
git-svn-id: https://develop.svn.wordpress.org/trunk@53876 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53874 602fd350-edb4-49c9-b593-d223f7449a82
This brings consistency with docblock used in `register_post_type()`.
Props audrasjb, bengreeley, dipakparmar443.
Fixes#56352
See #55646.
git-svn-id: https://develop.svn.wordpress.org/trunk@53873 602fd350-edb4-49c9-b593-d223f7449a82
This aims to bring more clarity to the code, and applies to methods where the path can be a file or a directory:
* `WP_Filesystem_*::exists()`
* `WP_Filesystem_*::is_writable()`
Follow-up to [6779], [25560].
See #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53872 602fd350-edb4-49c9-b593-d223f7449a82
The variable `$excluded_terms` is an array of excluded term IDs or empty string if none were provided.
Props grapplerulrich, costdev.
Fixes#56348.
git-svn-id: https://develop.svn.wordpress.org/trunk@53870 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53869 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@53868 602fd350-edb4-49c9-b593-d223f7449a82