WordPress/wp-admin/includes
Sergey Biryukov b90c2adb7f Database: Ignore display width for integer data types in dbDelta() on MySQL 8.0.17 or later.
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
2022-08-15 13:18:13 +00:00
..
admin-filters.php Bootstrap/Load: Move some more administration-related hooks to admin-filters.php. 2022-04-28 16:39:11 +00:00
admin.php
ajax-actions.php Media: Cache parent posts in query-attachments AJAX endpoint. 2022-08-12 00:17:07 +00:00
bookmark.php Docs: Add missing description for $pagenow global in various functions. 2022-04-04 18:26:06 +00:00
class-automatic-upgrader-skin.php
class-bulk-plugin-upgrader-skin.php
class-bulk-theme-upgrader-skin.php
class-bulk-upgrader-skin.php
class-core-upgrader.php Administration: Replace "can not" with "cannot" after [53131]. 2022-04-11 11:50:01 +00:00
class-custom-background.php Coding Standards: Escape the home URL in the "Background updated. Visit your site" message. 2022-07-04 10:14:14 +00:00
class-custom-image-header.php Coding Standards: Escape the home URL in the "Header updated. Visit your site" message. 2022-07-04 10:11:12 +00:00
class-file-upload-upgrader.php Coding Standards: Rename the $object variable to $attachment in several files. 2022-04-14 15:15:12 +00:00
class-ftp-pure.php
class-ftp-sockets.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:25:03 +00:00
class-ftp.php Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/class-ftp.php. 2022-03-26 15:28:08 +00:00
class-language-pack-upgrader-skin.php
class-language-pack-upgrader.php Administration: Remove self-reference ("we") in WordPress Admin. 2022-04-11 11:42:04 +00:00
class-pclzip.php
class-plugin-installer-skin.php Code Modernization: Replace phpversion() function calls with PHP_VERSION constant. 2022-05-20 17:38:14 +00:00
class-plugin-upgrader-skin.php
class-plugin-upgrader.php Code Modernization: Replace phpversion() function calls with PHP_VERSION constant. 2022-05-20 17:38:14 +00:00
class-theme-installer-skin.php Code Modernization: Replace phpversion() function calls with PHP_VERSION constant. 2022-05-20 17:38:14 +00:00
class-theme-upgrader-skin.php
class-theme-upgrader.php Code Modernization: Replace phpversion() function calls with PHP_VERSION constant. 2022-05-20 17:38:14 +00:00
class-walker-category-checklist.php
class-walker-nav-menu-checklist.php
class-walker-nav-menu-edit.php Menus: Use more appropriate escaping functions in class Walker_Nav_Menu_Edit. 2022-07-05 08:06:17 +00:00
class-wp-ajax-upgrader-skin.php
class-wp-application-passwords-list-table.php
class-wp-automatic-updater.php Code Modernization: Replace phpversion() function calls with PHP_VERSION constant. 2022-05-20 17:38:14 +00:00
class-wp-comments-list-table.php Docs: Use third-person singular verbs for function descriptions in WP_Comments_List_Table class, as per docblock standards. 2022-07-04 08:20:15 +00:00
class-wp-community-events.php Administration: Properly handle HTML entities in the News & Events dashboard widget. 2022-01-20 09:19:07 +00:00
class-wp-debug-data.php Code Modernization: Replace phpversion() function calls with PHP_VERSION constant. 2022-05-20 17:38:14 +00:00
class-wp-filesystem-base.php Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods. 2022-08-09 11:33:10 +00:00
class-wp-filesystem-direct.php Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods. 2022-08-09 11:33:10 +00:00
class-wp-filesystem-ftpext.php Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods. 2022-08-09 11:33:10 +00:00
class-wp-filesystem-ftpsockets.php Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods. 2022-08-09 11:33:10 +00:00
class-wp-filesystem-ssh2.php Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods. 2022-08-09 11:33:10 +00:00
class-wp-importer.php Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/class-wp-importer.php. 2022-03-30 10:45:06 +00:00
class-wp-internal-pointers.php External Libraries: Further fix jQuery deprecations in WordPress core. 2021-11-30 17:18:01 +00:00
class-wp-links-list-table.php
class-wp-list-table-compat.php
class-wp-list-table.php Administration: Improve performance of List Tables. 2022-08-09 00:33:11 +00:00
class-wp-media-list-table.php Accessibility: List Tables: Hide the Comments column icon and title attribute from screen readers. 2022-05-19 15:54:15 +00:00
class-wp-ms-sites-list-table.php Docs: Various inline documentation corrections and improvements. 2021-12-07 12:20:02 +00:00
class-wp-ms-themes-list-table.php
class-wp-ms-users-list-table.php I18N: Use a translatable string for displaying a user's first name and last name. 2022-06-14 14:43:12 +00:00
class-wp-plugin-install-list-table.php Docs: Improve plugin_install_action_links filter's docs. 2022-05-02 13:07:14 +00:00
class-wp-plugins-list-table.php Docs: Remove code tags from WordPress function names within inline documentation. 2022-08-11 13:55:08 +00:00
class-wp-post-comments-list-table.php
class-wp-posts-list-table.php Accessibility: List Tables: Hide the Comments column icon and title attribute from screen readers. 2022-05-19 15:54:15 +00:00
class-wp-privacy-data-export-requests-list-table.php Privacy: Fix "Retry" action after a personal data export failure. 2022-03-10 19:22:01 +00:00
class-wp-privacy-data-removal-requests-list-table.php
class-wp-privacy-policy-content.php Administration: Remove self-reference ("we") in WordPress Admin. 2022-04-11 11:42:04 +00:00
class-wp-privacy-requests-table.php Docs: Document the globals used in some Privacy API methods. 2021-11-24 11:41:03 +00:00
class-wp-screen.php Docs: Use third-person singular verbs for function descriptions in the WP_Screen API. 2022-06-16 23:10:10 +00:00
class-wp-site-health-auto-updates.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:25:03 +00:00
class-wp-site-health.php Coding Standards: Remove extra space in two conditionals. 2022-08-03 14:32:12 +00:00
class-wp-site-icon.php Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/class-wp-site-icon.php. 2022-04-11 14:21:09 +00:00
class-wp-terms-list-table.php Taxonomy: Introduce the is_term_publicly_viewable() function. 2022-08-13 22:44:09 +00:00
class-wp-theme-install-list-table.php Themes: Add version to theme screenshot URL for better browser cache handling. 2022-03-17 22:21:07 +00:00
class-wp-themes-list-table.php Themes: Add version to theme screenshot URL in WP_Themes_List_Table. 2022-03-18 12:44:04 +00:00
class-wp-upgrader-skin.php
class-wp-upgrader-skins.php
class-wp-upgrader.php Upgrade/Install: Add a conditional to facilitate testing of the Rollbacks feature project. 2022-06-26 12:37:18 +00:00
class-wp-users-list-table.php I18N: Use a translatable string for displaying a user's first name and last name. 2022-06-14 14:43:12 +00:00
comment.php Docs: Use third-person singular verbs for function descriptions in wp-admin/includes/comment.php, as per docblocks standards. 2022-07-20 22:15:10 +00:00
continents-cities.php
credits.php Help/About: Don't output empty <span> tags on Credits screen. 2021-10-19 23:09:00 +00:00
dashboard.php Docs: Remove code tags from WordPress function names within inline documentation. 2022-08-11 13:55:08 +00:00
deprecated.php Media: Remove attachment_fields_to_save filter and deprecate image_attachment_fields_to_save(). 2022-04-20 08:13:10 +00:00
edit-tag-messages.php Docs: Various inline documentation corrections and improvements. 2021-12-07 12:20:02 +00:00
export.php Docs: Various docblock improvements in Export Administration API, as per docs standards. 2022-07-29 08:14:12 +00:00
file.php Coding Standards: Use MINUTE_IN_SECONDS where appropriate. 2022-07-17 02:18:09 +00:00
image-edit.php Docs: Correct the return type for wp_save_image_file(). 2022-06-21 11:16:17 +00:00
image.php Media: use original image size data for full size secondary mime generation. 2022-08-05 22:16:13 +00:00
import.php Docs: Various docblock improvements in Importer Administration API, as per docs standards. 2022-07-29 09:22:10 +00:00
list-table.php Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/list-table.php. 2022-04-15 10:52:11 +00:00
media.php General: Add required fields helper functions for better reusability. 2022-08-12 12:11:09 +00:00
menu.php Coding Standards: Correct the $items_count variable in add_menu_classes(). 2022-04-17 14:44:07 +00:00
meta-boxes.php Revisions: Use wp_get_latest_revision_id_and_total_count() where appropriate. 2022-08-05 13:39:11 +00:00
misc.php Editor: Include user's name in the wp_refresh_post_lock() response. 2022-07-11 18:18:13 +00:00
ms-admin-filters.php
ms-deprecated.php
ms.php Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/ms.php. 2022-04-18 10:33:09 +00:00
nav-menu.php Menus: Use correct parameter in _wp_nav_menu_meta_box_object(). 2022-04-19 15:59:10 +00:00
network.php Administration: Add labels to read-only form fields. 2022-07-21 09:04:14 +00:00
noop.php
options.php External Libraries: Further fix jQuery deprecations in WordPress core. 2021-11-30 17:18:01 +00:00
plugin-install.php Coding standards: Properly escape URLs returned by self_admin_url() calls. 2022-08-05 06:12:10 +00:00
plugin.php Docs: Remove code tags from WordPress function names within inline documentation. 2022-08-11 13:55:08 +00:00
post.php Posts, Post Types: Standardize on $post parameter name where appropriate. 2022-07-18 17:37:17 +00:00
privacy-tools.php General: Replace all esc_url_raw() calls in core with sanitize_url(). 2022-06-01 18:14:10 +00:00
revision.php Revisions: Update the "last revision" wording to "latest revision" in various files. 2022-07-25 19:30:09 +00:00
schema.php Administration: Change default site tagline to an empty string. 2022-08-03 12:20:16 +00:00
screen.php
taxonomy.php Docs: Use third-person singular verbs for function descriptions in the Taxonomy Administration API. 2022-06-16 23:39:08 +00:00
template.php Docs: Correct and improve the documented types for various functions and hooks. 2022-08-11 14:03:09 +00:00
theme-install.php Coding standards: Properly escape URLs returned by self_admin_url() calls. 2022-08-05 06:00:09 +00:00
theme.php General: Replace all esc_url_raw() calls in core with sanitize_url(). 2022-06-01 18:14:10 +00:00
translation-install.php Docs: Fix incorrect type in translations_api and translations_api_result docblocks. 2022-01-27 21:15:03 +00:00
update-core.php Upgrade/Install: Update $_old_files for 6.0. 2022-05-23 17:02:16 +00:00
update.php Docs: Improve description for wp_plugin_update_rows() and wp_theme_update_rows(). 2022-07-09 12:59:11 +00:00
upgrade.php Database: Ignore display width for integer data types in dbDelta() on MySQL 8.0.17 or later. 2022-08-15 13:18:13 +00:00
user.php Text Changes: Improve consistency of admin error notices. 2022-06-02 15:05:13 +00:00
widgets.php Docs: Capitalize "ID", when referring to a widget ID or sidebar ID, in a more consistent way. 2021-12-13 10:21:07 +00:00