Make WordPress Core


Ignore:
Timestamp:
08/14/2022 02:12:22 AM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r53230 r53896  
    28922892                                        foreach ( $index_columns as $id => &$index_column ) {
    28932893                                                // Extract column name and number of indexed characters (sub_part).
     2894                                                // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
    28942895                                                preg_match(
    28952896                                                        '/'
    2896                                                         . '`?'                      // Name can be escaped with a backtick.
    2897                                                         . '(?P<column_name>'    // 1) Name of the column.
    2898                                                         . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+'
    2899                                                         . ')'
    2900                                                         . '`?'                      // Name can be escaped with a backtick.
    2901                                                         . '(?:'                     // Optional sub part.
    2902                                                         . '\s*'                 // Optional white space character between name and opening bracket.
    2903                                                         . '\('                  // Opening bracket for the sub part.
    2904                                                         . '\s*'             // Optional white space character after opening bracket.
    2905                                                         . '(?P<sub_part>'
    2906                                                         . '\d+'         // 2) Number of indexed characters.
    2907                                                         . ')'
    2908                                                         . '\s*'             // Optional white space character before closing bracket.
    2909                                                         . '\)'                 // Closing bracket for the sub part.
    2910                                                         . ')?'
     2897                                                        .   '`?'                      // Name can be escaped with a backtick.
     2898                                                        .       '(?P<column_name>'    // 1) Name of the column.
     2899                                                        .           '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+'
     2900                                                        .       ')'
     2901                                                        .   '`?'                      // Name can be escaped with a backtick.
     2902                                                        .   '(?:'                     // Optional sub part.
     2903                                                        .       '\s*'                 // Optional white space character between name and opening bracket.
     2904                                                        .       '\('                  // Opening bracket for the sub part.
     2905                                                        .           '\s*'             // Optional white space character after opening bracket.
     2906                                                        .           '(?P<sub_part>'
     2907                                                        .               '\d+'         // 2) Number of indexed characters.
     2908                                                        .           ')'
     2909                                                        .           '\s*'             // Optional white space character before closing bracket.
     2910                                                        .       '\)'                  // Closing bracket for the sub part.
     2911                                                        .   ')?'
    29112912                                                        . '/',
    29122913                                                        $index_column,
    29132914                                                        $index_column_matches
    29142915                                                );
     2916                                                // phpcs:enable
    29152917
    29162918                                                // Escape the column name with backticks.
Note: See TracChangeset for help on using the changeset viewer.