Skip to content

Commit

Permalink
clean up the regex
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekn committed Dec 20, 2024
1 parent 3704af6 commit 86547ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wp-includes/sqlite/class-wp-sqlite-translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3761,7 +3761,7 @@ function ( $column ) use ( $table_name, $key_length_limit ) {
$data_length = $key_length_limit;

// Extract the length from the data type. Make it lower if needed. Skip 'unsigned' parts and whitespace.
if ( 1 === preg_match( '/^(\w+)\s*\(\s*(\d+)\s*\)\s*(.*)?$/', $data_type, $matches ) ) {
if ( 1 === preg_match( '/^(\w+)\s*\(\s*(\d+)\s*\)/', $data_type, $matches ) ) {
$data_type = $matches[1]; // "varchar"
$data_length = min( $matches[2], $key_length_limit ); // "255"
}
Expand Down

0 comments on commit 86547ee

Please sign in to comment.