diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
index 85439b4..7368b46 100644
|
|
|
function dbDelta( $queries = '', $execute = true ) {
|
| 2670 | 2670 | if ( array_key_exists( $tablefield_field_lowercased, $cfields ) ) { |
| 2671 | 2671 | |
| 2672 | 2672 | // Get the field type from the query. |
| 2673 | | preg_match( '|`?' . $tablefield->Field . '`? ([^ ]*( unsigned)?)|i', $cfields[ $tablefield_field_lowercased ], $matches ); |
| | 2673 | preg_match( '|`?' . $tablefield->Field . '`?\s+([^ ]*( unsigned)?)|i', $cfields[ $tablefield_field_lowercased ], $matches ); |
| 2674 | 2674 | $fieldtype = $matches[1]; |
| 2675 | 2675 | $fieldtype_lowercased = strtolower( $fieldtype ); |
| 2676 | 2676 | |
diff --git tests/phpunit/tests/dbdelta.php tests/phpunit/tests/dbdelta.php
index 1e9c93f..c1b64cc 100644
|
|
|
class Tests_dbDelta extends WP_UnitTestCase {
|
| 996 | 996 | $updates |
| 997 | 997 | ); |
| 998 | 998 | } |
| | 999 | |
| | 1000 | /** |
| | 1001 | * @ticket 44767 |
| | 1002 | */ |
| | 1003 | function test_ignore_change_with_space_between_column_and_type() { |
| | 1004 | global $wpdb; |
| | 1005 | |
| | 1006 | $schema = " |
| | 1007 | CREATE TABLE {$wpdb->prefix}dbdelta_test3 ( |
| | 1008 | `foo-bar` varchar(255) DEFAULT NULL |
| | 1009 | ) |
| | 1010 | "; |
| | 1011 | |
| | 1012 | $wpdb->query( $schema ); |
| | 1013 | |
| | 1014 | $schema_update = " |
| | 1015 | CREATE TABLE {$wpdb->prefix}dbdelta_test3 ( |
| | 1016 | `foo-bar` varchar(255) DEFAULT NULL |
| | 1017 | ) |
| | 1018 | "; |
| | 1019 | |
| | 1020 | $updates = dbDelta( $schema_update ); |
| | 1021 | |
| | 1022 | $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}dbdelta_test3" ); |
| | 1023 | |
| | 1024 | $this->assertEmpty( $updates ); |
| | 1025 | } |
| 999 | 1026 | } |