From d51b039755431df833162d1a3a72ac5d3812ee24 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 14 Aug 2022 02:12:22 +0000 Subject: [PATCH] Coding Standards: Restore correct regex formatting in `dbDelta()`. 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 --- src/wp-admin/includes/upgrade.php | 32 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 82fda9682f..dfe38d29e3 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -2891,27 +2891,29 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N // Normalize columns. foreach ( $index_columns as $id => &$index_column ) { // Extract column name and number of indexed characters (sub_part). + // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation preg_match( '/' - . '`?' // Name can be escaped with a backtick. - . '(?P' // 1) Name of the column. - . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+' - . ')' - . '`?' // Name can be escaped with a backtick. - . '(?:' // Optional sub part. - . '\s*' // Optional white space character between name and opening bracket. - . '\(' // Opening bracket for the sub part. - . '\s*' // Optional white space character after opening bracket. - . '(?P' - . '\d+' // 2) Number of indexed characters. - . ')' - . '\s*' // Optional white space character before closing bracket. - . '\)' // Closing bracket for the sub part. - . ')?' + . '`?' // Name can be escaped with a backtick. + . '(?P' // 1) Name of the column. + . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+' + . ')' + . '`?' // Name can be escaped with a backtick. + . '(?:' // Optional sub part. + . '\s*' // Optional white space character between name and opening bracket. + . '\(' // Opening bracket for the sub part. + . '\s*' // Optional white space character after opening bracket. + . '(?P' + . '\d+' // 2) Number of indexed characters. + . ')' + . '\s*' // Optional white space character before closing bracket. + . '\)' // Closing bracket for the sub part. + . ')?' . '/', $index_column, $index_column_matches ); + // phpcs:enable // Escape the column name with backticks. $index_column = '`' . $index_column_matches['column_name'] . '`';