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 each of the cases included in this commit, one or more individual tests set a property to allow a filter or action access to certain information.
This commit:
* Explicitly declares these properties and documents in which tests they are being used.
* Adds a reset to the default value of the property to a pre-existing `tear_down()` method or adds that method specifically for that purpose. This ensures that tests do not accidentally “taint” each other.
As these properties are being declared on test classes, they are marked as private. Even though the original dynamic property was public, this should not be considered a backward compatibility break as this only involves test classes.
Includes:
* In the `Tests_Post_Query` class, there were two tests assigning a value to an undeclared `$post_id` property, but subsequently not using the property, so those assignments should have been to a local variable (if they should be assignments at all).
* In the `Test_User_Capabilities` class, the property name had a leading `_` underscore. This is an outdated PHP 4 practice to indicate a private property. As PHP 4 is no longer supported, the leading underscore is removed from the property name.
* In the `Tests_User_Capabilities` class, an unused `$_role_test_wp_roles_role` property was declared somewhere in the middle of the class. That property is now removed in favor of `$_role_test_wp_roles_init`, which appears to be the intended name, previously misspelled.
Follow-up to [27294], [36277], [36750], [37712], [38571], [39082], [40290], [43049], [44628], [48328], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53942
git-svn-id: http://core.svn.wordpress.org/trunk@53501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add object caching to the first database query in `WP_Query`, ie the database query for post IDs that match the desired result. Randomly ordered queries remain uncached as they are not intended to return consistent results.
Caching of ID queries is enabled by default, per the post object, term and meta caches.
Props spacedmonkey, aaroncampbell, batmoo, chriscct7, costdev, dd32, drewapicture, johnbillion, mukesh27, nacin, ocean90, peterwilsoncc, ryan, scribu, sergeybiryukov, tillkruss.
Fixes#22176.
Built from https://develop.svn.wordpress.org/trunk@53941
git-svn-id: http://core.svn.wordpress.org/trunk@53500 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 test file, the `Tests_Comment_Walker::set_up()` method created a dynamic `$post_id` property, which should have been explicitly declared.
Along the same lines, the `Comment_Callback_Test::__construct()` method also assigned values to two undeclared properties.
This is now fixed by explicitly declaring the properties in both classes.
Includes renaming the `Comment_Callback_Test` class to `Comment_Callback_Test_Helper` as it does not contain any test methods and its only purpose is as a “helper” class for the `Tests_Comment_Walker::test_has_children()` test.
Follow-up to [28824], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53938
git-svn-id: http://core.svn.wordpress.org/trunk@53497 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 `scandir()` method sets a dynamic `$matched_dirs` property, which is subsequently used in the `delete_folders()` method.
This commit removes the need for the property. Effectively, this changes the `scandir()` method to return an array of the matched directories instead of setting the property by using recursion in the method itself in an optimized manner.
Note the `array_merge()` not being in the loop itself, but at the very end of the function. This is for performance reasons, see [https://github.com/dseguy/clearPHP/blob/master/rules/no-array_merge-in-loop.md clearPHP: No array_merge() In Loops] for a more detailed explanation of this.
It has been verified in detail that the actual results of the previous version of the method and this version match, even when the paths passed are more complex and have deeper nested subdirectories.
Follow-up to [30658], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936].
Props jrf, johnbillion, markjaquith, SergeyBiryukov.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53937
git-svn-id: http://core.svn.wordpress.org/trunk@53496 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 these particular cases, individual tests set a couple of properties (`$author_id`, `$post_id`) that are never used outside of the context of the test in which they are created.
In other words: these should never have been properties, but should be local variables instead.
Follow-up to [38832], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53936
git-svn-id: http://core.svn.wordpress.org/trunk@53495 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_create_update_post_with_featured_media()` method creates an attachment and writes the ID of the attachment to a dynamic (undeclared) property to be used as a flag to determine whether attachments need to be cleaned up after the test in the `tear_down()` method.
As the actual ''value'' of the property is irrelevant for the cleaning up and the property is realistically being used as a “flag”, this is now fixed as follows:
* Have an actual “flag” property declared with a descriptive name — `$attachments_created` — to make the code in the `tear_down()` more easily understandable.
* As for the actual ID of the attachment, save that to a test method local variable as that is the only place where it has any relevance.
Includes moving the `tear_down()` method up to be directly below the `set_up()` method.
Follow-up to [38832], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916].
Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53935
git-svn-id: http://core.svn.wordpress.org/trunk@53494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, Windows paths in the `path_is_absolute` function resulted in incorrect URIs. This patch adjusts for forward slashes and adds tests for the `get_attached_file` function.
Props Whissi, SergeyBiryukov, desrosj, stevenlinx, birgire, davidbaumwald, costdev, peterwilsoncc, audrasjb, hellofromTonya, johnbillion.
Fixes#36308.
Built from https://develop.svn.wordpress.org/trunk@53934
git-svn-id: http://core.svn.wordpress.org/trunk@53493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This allows third-party themes to avoid accidentally being overwritten with an update of a theme of a similar name from the WordPress.org Theme Directory.
Additionally, introduce the `update_themes_{$hostname}` filter, which third-party themes can use to offer updates for a given hostname.
If set, the `Update URI` header field should be a URI and have a unique hostname.
Some examples include:
* `https://wordpress.org/themes/example-theme/`
* `https://example.com/my-theme/`
* `my-custom-theme-name`
`Update URI: false` also works, and unless there is code handling the `false` hostname, the theme will never get an update notification.
If the header is present, the WordPress.org API will currently only return updates for the theme if it matches the following format:
* `https://wordpress.org/themes/{$slug}/`
* `w.org/theme/{$slug}`
If the header has any other value, the API will not return a result and will ignore the theme for update purposes.
Follow-up to [50921].
Props dd32, meloniq, costdev, audrasjb, DavidAnderson, markjaquith, DrewAPicture, mweichert, design_dolphin, filosofo, sean212, nhuja, JeroenReumkens, infolu, dingdang, joyously, earnjam, williampatton, grapplerulrich, markparnell, apedog, afragen, miqrogroove, rmccue, crazycoders, jdgrimes, damonganto, joostdevalk, jorbin, georgestephanis, khromov, GeekStreetWP, jb510, Rarst, juliobox, Ipstenu, mikejolley, Otto42, gMagicScott, TJNowell, GaryJ, knutsp, mordauk, nvartolomei, aspexi, chriscct7, benoitchantre, ryno267, lev0, gregorlove, dougwollison, leemon, SergeyBiryukov.
See #14179, #23318, #32101.
Built from https://develop.svn.wordpress.org/trunk@53933
git-svn-id: http://core.svn.wordpress.org/trunk@53492 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.
- @wordpress/block-directory@3.4.14
- @wordpress/block-editor@8.5.10
- @wordpress/block-library@7.3.14
- @wordpress/customize-widgets@3.3.14
- @wordpress/edit-post@6.3.14
- @wordpress/edit-site@4.3.14
- @wordpress/edit-widgets@4.3.14
- @wordpress/editor@12.5.10
- @wordpress/format-library@3.4.10
- @wordpress/reusable-blocks@3.4.10
- @wordpress/widgets@2.4.10
Props SergeyBiryukov.
Fixes#56414.
Built from https://develop.svn.wordpress.org/trunk@53929
git-svn-id: http://core.svn.wordpress.org/trunk@53488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The function was using the `array_column()` PHP function on an array of objects, which works as expected on PHP 7 or later, but not on PHP 5.6.
This resulted in customized templates being listed multiple times on the Templates and Template Parts screens, and being repeatedly added between lists when switching between the screens.
The issue is now resolved by replacing `array_column()` with the `wp_list_pluck()` WordPress core function, which provides consistent behavior beetween PHP versions.
Reference: [https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L626 PHP 7.0 Upgrade Notes: array_column()].
Props uofaberdeendarren, antonvlasenko, ironprogrammer, jonmackintosh, costdev, hellofromTonya, swissspidy, rudlinkon.
Fixes#56271.
Built from https://develop.svn.wordpress.org/trunk@53927
git-svn-id: http://core.svn.wordpress.org/trunk@53486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This makes a transparent circle SVG smaller by removing empty space to match the height of other images in the same section, so that all three columns are aligned correctly.
Follow-up to [53339].
Props sabernhardt, weboccults, ironprogrammer, webcommsat, marybaum, oglekler.
Fixes#56210.
Built from https://develop.svn.wordpress.org/trunk@53924
git-svn-id: http://core.svn.wordpress.org/trunk@53483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
PHP 8.2 is expected to be released at the end of November 2022.
Enabling the tests to run in CI on PHP 8.2 allows WordPress core to start getting ready.
As an interim measure, while working through the PHP 8.1 and 8.2 issues, builds against these PHP versions are allowed to fail, so that they don't block PR merges in the Gutenberg project.
Notes:
* The `composer install` command for PHP 8.1 was still using the `--ignore-platform-reqs` option, while that has not been needed anymore for quite a while, so the condition is now reused for PHP 8.2.
* The `--ignore-platform...` option used for the install is now made more specific:
* Composer 2.0 added a `--ignore-platform-req=...` option to selectively ignore platform requirements.
* Composer 2.2 then added the ability to only ignore the upper bound of platform requirements by adding the `+` sign.
* Xdebug-related tests will not be run on PHP 8.2 at this time as the Docker image for PHP 8.2 does not contain Xdebug yet. Once a stable release of Xdebug 3.2.0 is available, it can be added to the Docker image and the test step can then be enabled for PHP 8.2.
References:
* [https://github.com/WordPress/wpdev-docker-images/pull/87 wpdev-docker-images PR #87: Add PHP 8.2 containers]
* [https://github.com/composer/composer/releases/tag/2.0.0 Composer 2.0 changelog]
* [https://github.com/composer/composer/releases/tag/2.2.0 Composer 2.2 changelog]
* [https://xdebug.org/announcements/2022-07-20 Xdebug 3.2.0alpha1 release notes]
* [https://xdebug.org/announcements/2022-07-25 Xdebug 3.2.0alpha2 release notes]
Follow-up to [49077], [49162], [50299], [51588], [51604].
Props jrf, desrosj.
See #56009.
Built from https://develop.svn.wordpress.org/trunk@53922
git-svn-id: http://core.svn.wordpress.org/trunk@53481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
WordPress core test suite uses PHPUnit's `beStrictAboutTestsThatDoNotTestAnything` option set to `true`, which marks a test as risky when no assertions are performed.
REST API test classes have some empty tests for non-implemented methods because these test classes extend the abstract `WP_Test_REST_Controller_Testcase` class, which requires several methods to be implemented that don't necessarily make sense for all REST API routes.
Some of these empty tests were already marked as skipped, but not in a consistent manner. Since skipping these tests is intentional for the time being, this commit aims to bring some consistency and adjust them all to be more accurately reported as skipped instead of risky.
The skipping can be reconsidered in the future when the tests are either removed as unnecessary or updated to actually perform assertions related to their behavior.
Follow-up to [40534], [41176], [41228].
Props Mte90, tomepajk, johnbillion, zieladam, SergeyBiryukov.
See #40538, #41463, #55652.
Built from https://develop.svn.wordpress.org/trunk@53921
git-svn-id: http://core.svn.wordpress.org/trunk@53480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This makes sure there are no leftover images in case of a test failure.
Applies to: `test_wp_calculate_image_srcset_no_date_uploads()`.
Includes renaming the `$int` variable to `$int_size` for consistency with some other tests.
Follow-up to [34855], [35412], [35751], [53463].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53920
git-svn-id: http://core.svn.wordpress.org/trunk@53479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
MariaDB version is reported differently between PHP versions:
* PHP 8.0.16 or later: `10.6.8-MariaDB`
* PHP 8.0.15 or earlier: `5.5.5-10.6.8-MariaDB`
The latter includes PHP 7.4.x and PHP 5.6.x as well, where the version is also reported with the `5.5.5-` prefix.
This commit makes an adjustment to the `Tests_DB_Charset` class to check for the correct version.
References:
* [https://github.com/php/php-src/issues/7972 php-src: #7972: MariaDB version prefix 5.5.5- is not stripped]
* [https://github.com/php/php-src/pull/7963 php-src: PR #7963 Fix GH-7932: MariaDB version prefix not always stripped]
Follow-up to [53918].
Fixes#53623.
Built from https://develop.svn.wordpress.org/trunk@53919
git-svn-id: http://core.svn.wordpress.org/trunk@53478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
From [https://mariadb.com/kb/en/mariadb-1061-release-notes/ MariaDB 10.6.1 release notes]:
> The `utf8` [https://mariadb.com/kb/en/character-sets/ character set] (and related collations) is now by default an alias for `utf8mb3` rather than the other way around. It can be set to imply `utf8mb4` by changing the value of the [https://mariadb.com/kb/en/server-system-variables/#old_mode old_mode] system variable ([https://jira.mariadb.org/browse/MDEV-8334 MDEV-8334]).
From [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-30.html#mysqld-8-0-30-charset MySQL 8.0.30 release notes]:
> **Important Change:** A previous change renamed character sets having deprecated names prefixed with `utf8_` to use `utf8mb3_` instead. In this release, we rename the `utf8_` collations as well, using the `utf8mb3_` prefix; this is to make the collation names consistent with those of the character sets, not to rely any longer on the deprecated collation names, and to clarify the distinction between `utf8mb3` and `utf8mb4`. The names using the `utf8mb3_` prefix are now used exclusively for these collations in the output of `SHOW` statements such as `SHOW CREATE TABLE`, as well as in the values displayed in the columns of Information Schema tables including the `COLLATIONS` and `COLUMNS` tables.
This commit adds `utf8mb3_bin` and `utf8mb3_general_ci` to the list of safe collations recognized by `wpdb::check_safe_collation()`. The full list is now as follows:
* `utf8_bin`
* `utf8_general_ci`
* `utf8mb3_bin`
* `utf8mb3_general_ci`
* `utf8mb4_bin`
* `utf8mb4_general_ci`
The change is covered by existing database charset unit tests: six tests which previously failed on MariaDB 10.6.1+ or MySQL 8.0.30+ now pass.
Includes:
* Adjusting the expected test results based on MariaDB and MySQL version.
* Using named data providers for the affected tests to make test output more descriptive.
* Adding a failure message to each assertion when multiple assertions are used in the test.
References:
* [https://mariadb.com/kb/en/mariadb-1061-release-notes/ MariaDB 10.6.1 release notes]
* [https://jira.mariadb.org/browse/MDEV-8334 MDEV-8334 Rename utf8 to utf8mb3]
* [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-30.html#mysqld-8-0-30-charset MySQL 8.0.30 release notes]
* [https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)]
Follow-up to [30345], [32162], [37320].
Props skithund, ayeshrajans, JavierCasares, SergeyBiryukov.
Fixes#53623.
Built from https://develop.svn.wordpress.org/trunk@53918
git-svn-id: http://core.svn.wordpress.org/trunk@53477 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 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.
Built from https://develop.svn.wordpress.org/trunk@53916
git-svn-id: http://core.svn.wordpress.org/trunk@53475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53915
git-svn-id: http://core.svn.wordpress.org/trunk@53474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53914
git-svn-id: http://core.svn.wordpress.org/trunk@53473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53911
git-svn-id: http://core.svn.wordpress.org/trunk@53470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53909
git-svn-id: http://core.svn.wordpress.org/trunk@53468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53908
git-svn-id: http://core.svn.wordpress.org/trunk@53467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53906
git-svn-id: http://core.svn.wordpress.org/trunk@53465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53904
git-svn-id: http://core.svn.wordpress.org/trunk@53463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53900
git-svn-id: http://core.svn.wordpress.org/trunk@53459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@53898
git-svn-id: http://core.svn.wordpress.org/trunk@53457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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